- Troubleshooting
- Resources
DataFetcher
Fetches data from a datasource.
Inputs
None.
Outputs
One output. No naming constraint for outputKey
and outputName
.
Parameters
name | description | default value |
---|---|---|
| ThirdEye datasource to use. |
|
| Query to execute. The query can use macros. |
|
Example
{
"name": "currentDataFetcher",
"type": "DataFetcher",
"params": {
"component.dataSource": "pinot", # ThirdEye datasource
"component.query": "SELECT __timeGroup(timeColumn, 'EPOCH', 'P1D') as ts, sum(views) as met FROM pageviews WHERE __timeFilter(timeColumn, 'EPOCH') GROUP BY ts ORDER BY ts LIMIT 10000"
},
"inputs": [],
"outputs": [
{
"outputKey": "currentData", # no constraint
"outputName": "currentOutput" # no constraint
}
]
}
Macros
Macros are special functions that are translated by ThirdEye to SQL before the query is sent to the database. Macros have access to detection runtime information, like the start and the end time of the detection, the timezone.
Macro example | description |
---|---|
| Replaced by a time range filter on the timeframe For example, |
| Replaced by a time range filter on the timeframe For example, for a detection between January 14 and January 15, |
| Replaced by a time range filter on the timeframe For example, for a detection between January 14 and January 15, |
| Replaced by a transformation of the timeColumn in bins of the given granularity, in milliseconds. For example, |
AUTO keyword
If the timeColumn
value is AUTO
, the macro resolves to the primary time column of the table.
timeFormat
is obtained internally and can be left blank.
For example:
__timeFilter(AUTO,'')
__timeGroup(AUTO,'','P1D')
timeFormat strings
Available timeformat strings are:
String | description | aliases |
---|---|---|
| time column is in milliseconds since unix epoch |
|
| time column is in seconds since unix epoch |
|
| time column is in minutes since unix epoch |
|
| time column is in hours since unix epoch |
|
| time column is in days since unix epoch |
|
any SimpleDateFormat string | See SimpleDateFormat documentation. Eg |
|