You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/source/querying-data.rst
+6-6
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ Measurement Queries
27
27
28
28
To query for a specific measurement, the right-hand side of the ``MeasurementQuery`` should be a Python ``str``:
29
29
30
-
>>> fromtinydbimport MeasurementQuery
30
+
>>> fromtinyfluximport MeasurementQuery
31
31
>>> Measurement = MeasurementQuery()
32
32
>>> db.search(Measurement =="city temperatures")
33
33
@@ -36,7 +36,7 @@ Tag Queries
36
36
37
37
To query for tags, the *tag key* of interest takes the form of a query attribute (following the ``.``), while the *tag value* forms the right-hand side. An example to illustrate:
38
38
39
-
>>> fromtinydbimport TagQuery
39
+
>>> fromtinyfluximport TagQuery
40
40
>>> Tags = TagQuery()
41
41
>>> db.search(Tags.city =="Greenwich")
42
42
@@ -47,15 +47,15 @@ Field Queries
47
47
48
48
Similar to tags, to query for fields, the field key takes the form of a query attribute, while the field value forms the right-hand side:
49
49
50
-
>>> fromtinydbimport FieldQuery
50
+
>>> fromtinyfluximport FieldQuery
51
51
>>> Fields = FieldQuery()
52
52
>>> db.search(Fields.high >50.0)
53
53
54
54
This will query the database for all points with the field key of ``high`` exceeding the value of 50.0.
55
55
56
56
Some tag keys and field keys are not valid Python identifiers (for example, if the key contains whitespace), and can alternately be queried with string attributes:
57
57
58
-
>>> fromtinydbimport TagQuery
58
+
>>> fromtinyfluximport TagQuery
59
59
>>> Tags = TagQuery()
60
60
>>> db.search(Tags["country name"] =="United States of America")
61
61
@@ -64,7 +64,7 @@ Time Queries
64
64
65
65
To query based on time, the "right-hand side" of the ``TimeQuery`` should be a timezone-aware ``datetime`` object:
@@ -151,7 +151,7 @@ Compound Queries and Query Modifiers
151
151
152
152
TinyFlux also allows supports compound queries through the use of logical operators. This is particularly useful for time queries when a time range is needed.
153
153
154
-
>>> fromtinydbimport TimeQuery
154
+
>>> fromtinyfluximport TimeQuery
155
155
>>> from datetime import datetime, timezone
156
156
>>> Time = TimeQuery()
157
157
>>> q1 = Time > datetime(1990, 1, 1, tzinfo=timezone.utc)
0 commit comments