Skip to content

Commit

Permalink
Add SQLMesh (#1967)
Browse files Browse the repository at this point in the history
* Update deps

* Adds initial sqlmesh skeleton
  • Loading branch information
ravenac95 authored Aug 20, 2024
1 parent 8bbc1ae commit 5fb2c96
Show file tree
Hide file tree
Showing 11 changed files with 603 additions and 497 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,6 @@ supabase/.temp/
base_playground/
playground/
production/

# sqlmesh
.cache/
1,064 changes: 568 additions & 496 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ sqlalchemy = "^2.0.25"
textual = "^0.52.1"
redis = "^5.0.7"
githubkit = "^0.11.6"
sqlmesh = "^0.113.0"
sqlmesh = "^0.117.0"
dagster-duckdb = "^0.24.0"
dagster-duckdb-polars = "^0.24.0"

Expand Down
Empty file.
11 changes: 11 additions & 0 deletions warehouse/clickhouse-mesh/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
gateways:
local:
connection:
type: duckdb
database: /data/int_events/test.db

default_gateway: local

model_defaults:
dialect: duckdb
start: 2024-08-19
Empty file.
Empty file.
Empty file.
20 changes: 20 additions & 0 deletions warehouse/clickhouse-mesh/models/incremental_model.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
MODEL (
name metrics.incremental_model,
kind INCREMENTAL_BY_TIME_RANGE (
time_column bucket_day,
batch_size 1
),
start '2018-01-01',
cron '@daily',
grain (bucket_day, event_type)
);

SELECT
time_bucket(INTERVAL 1 DAY, @start_date) as bucket_day,
event_type,
count(event_type) as events
FROM
sources.int_events
WHERE
time BETWEEN (@start_date - INTERVAL 30 DAY) AND @end_date
GROUP BY bucket_day, event_type
Empty file.
Empty file.

0 comments on commit 5fb2c96

Please sign in to comment.