SQLite Implementation
The SQLite engine applies the second-level query to the data fetched by the data filter. This query is a SQL-compliant one with some restrictions enforced by the DataHub query engine:
- Only a single query is supported, no multiple comma-separated queries
- No SQL statement other than SELECT ... FROM Data is allowed
- The query may only use Data table as source table
- Common Table Expressions (CTE) are not supported
- Join clauses are not supported
Input table
The only table that you can query is called Data and has the following schema:
CREATE TABLE Data (
variableId INT,
sourceId INT,
value DOUBLE,
timeStamp TIMESTAMP)
This means that you can only specify VariableId, SourceId, Value and TimeStamp as source columns.
Note
You can select a constant (SELECT 'Some constant', ... FROM Data) or computation result (SELECT 1 + 2, ... as Result FROM Data). Although being useless, if you do not select any column from Data table, you still need to provide the source table, which would return 1 constant/result per row in Data table. Use DISTINCT to get a single result: SELECT DISTINCT 'Some constant' FROM Data
Result set
The structure and content of the result set is driven by the query which drives the following result set characteristics:
- the number of columns per row
- the name of each column (use SQL aliases to customize a column name)
- the type of each column (use SQL CAST to customize a column type )