Data Sources

Below are sample dataset queries for different data warehouses and databases.

BigQuery

SELECT
TIMESTAMP_TRUNC(CreatedTS, DAY) as OrderDate, -- HOUR or DAY granularity
City, State, -- dimensions
COUNT(1) as Orders, SUM(IFNULL(Order_Amount,0)) as OrderAmount -- measures
FROM ORDERS
WHERE CreatedTS >= TIMESTAMP_SUB(TIMESTAMP_TRUNC(CURRENT_TIMESTAMP(), DAY), INTERVAL 400 DAY)  -- limit historical data to use for forecasting
GROUP BY 1, 2, 3
ORDER BY 1

Redshift

SELECT
DATE_TRUNC('day', CreatedTS) as OrderDate, -- 'hour' or 'day' granularity
City, State, -- dimensions
COUNT(1) as Orders, SUM(NVL(Order_Amount,0)) as OrderAmount -- measures
FROM ORDERS
WHERE CreatedTS >= DATE_TRUNC('day', SYSDATE) - INTERVAL '400 days'  -- limit historical data to use for forecasting
GROUP BY 1, 2, 3
ORDER BY 1

Snowflake

Postgres

MySQL

Hourly granularity

Daily granularity

Druid

SQL Server

Hourly granularity

Daily granularity

Last updated

Was this helpful?