@@ -15,21 +15,24 @@ def render_query(dataset, tables, select=None, conditions=None,
15
15
tables : Union[dict, list]
16
16
The table in `dataset` to query.
17
17
select : dict, optional
18
- The keys function as column names and the values function as options to apply to
19
- the select field such as alias and format. For example, select['start_time'] might
20
- have the form {'alias': 'StartTime', 'format': 'INTEGER-FORMAT_UTC_USEC'}, which would
21
- be represented as 'SEC_TO_TIMESTAMP(INTEGER(start_time)) as StartTime' in a query. Pass
22
- `None` to seoect all.
18
+ The keys function as column names and the values function as options to
19
+ apply to the select field such as alias and format. For example,
20
+ select['start_time'] might have the form
21
+ {'alias': 'StartTime', 'format': 'INTEGER-FORMAT_UTC_USEC'}, which
22
+ would be represented as 'SEC_TO_TIMESTAMP(INTEGER(start_time)) as
23
+ StartTime' in a query. Pass `None` to select all.
23
24
conditions : list, optional
24
- a ``list`` of ``dict`` objects to filter results by. Each dict should have the keys 'field',
25
- 'type', and 'comparators'. The first two map to strings representing the field (e.g. 'foo')
26
- and type (e.g. 'FLOAT'). 'comparators' maps to another ``dict`` containing the keys 'condition',
27
- 'negate', and 'value'. If 'comparators' = {'condition': '>=', 'negate': False, 'value': 1}, this
28
- example will be rdnered as 'foo >= FLOAT('1')' in the query.
25
+ a ``list`` of ``dict`` objects to filter results by. Each dict should
26
+ have the keys 'field', 'type', and 'comparators'. The first two map to
27
+ strings representing the field (e.g. 'foo') and type (e.g. 'FLOAT').
28
+ 'comparators' maps to another ``dict`` containing the keys 'condition',
29
+ 'negate', and 'value'.
30
+ If 'comparators' = {'condition': '>=', 'negate': False, 'value': 1},
31
+ this example will be rdnered as 'foo >= FLOAT('1')' in the query.
29
32
``list`` of field names to group by
30
33
order_by : dict, optional
31
- Keys = {'field', 'direction'}. `dict` should be formatted as {'field':'TimeStamp, 'direction':'desc'}
32
- or similar
34
+ Keys = {'field', 'direction'}. `dict` should be formatted as
35
+ {'field':'TimeStamp, 'direction':'desc'} or similar
33
36
34
37
Returns
35
38
-------
@@ -149,7 +152,8 @@ def _render_sources(dataset, tables):
149
152
tables ['from_date' ],
150
153
tables ['to_date' ])
151
154
except KeyError as exp :
152
- logger .warn ('Missing parameter %s in selecting sources' % (exp ))
155
+ logger .warn (
156
+ 'Missing parameter %s in selecting sources' % (exp ))
153
157
154
158
else :
155
159
return "FROM " + ", " .join (
0 commit comments