Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates SQLMesh to the latest version #2679

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
583 changes: 308 additions & 275 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 @@ -59,7 +59,7 @@ sqlalchemy = "^2.0.25"
textual = "^0.52.1"
redis = "^5.0.7"
githubkit = "^0.11.6"
sqlmesh = { extras = ["trino"], version = "^0.129.0" }
sqlmesh = "^0.141.1"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will need to add the trino extras here

dagster-duckdb = "^0.24.0"
dagster-duckdb-polars = "^0.24.0"
google-cloud-bigquery-storage = "^2.25.0"
Expand Down
3 changes: 3 additions & 0 deletions warehouse/metrics_mesh/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
connection=DuckDBConnectionConfig(
database=os.environ.get("SQLMESH_DUCKDB_LOCAL_PATH")
),
test_connection=DuckDBConnectionConfig(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this local testing thing!

database="/Users/raven/testing-duckdb.db",
),
variables={
"oso_source_db": "sources",
},
Expand Down
2 changes: 1 addition & 1 deletion warehouse/metrics_mesh/models/events_daily_to_artifact.sql
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ GROUP BY
to_artifact_id,
event_source,
event_type,
DATE_TRUNC('DAY', time::DATE)
DATE_TRUNC('DAY', time::DATE)
14 changes: 7 additions & 7 deletions warehouse/metrics_mesh/tests/test_events_daily_to_artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,43 @@ test_events_daily_to_artifact:
from_artifact_id: user_0
event_source: BLOCKCHAIN
event_type: CONTRACT_INVOCATION_SUCCESS_DAILY_COUNT
time: 2024-01-01T00:00:00Z
time: "2024-01-01 00:00:00+00:00"
amount: 10
- to_artifact_id: contract_1
from_artifact_id: user_0
event_source: BLOCKCHAIN
event_type: CONTRACT_INVOCATION_SUCCESS_DAILY_COUNT
time: 2024-01-01T00:00:00Z
time: "2024-01-01 00:00:00+00:00"
amount: 10
- to_artifact_id: repo_0
from_artifact_id: dev_0
event_source: SOURCE_PROVIDER
event_type: COMMIT_CODE
time: 2024-01-01T02:00:00Z
time: "2024-01-01 02:00:00+00:00"
amount: 1
- to_artifact_id: repo_0
from_artifact_id: dev_0
event_source: SOURCE_PROVIDER
event_type: COMMIT_CODE
time: 2024-01-01T03:00:00Z
time: "2024-01-01 03:00:00+00:00"
amount: 1
- to_artifact_id: repo_0
from_artifact_id: dev_0
event_source: SOURCE_PROVIDER
event_type: COMMIT_CODE
time: 2024-01-01T04:00:00Z
time: "2024-01-01 04:00:00+00:00"
amount: 1
- to_artifact_id: repo_0
from_artifact_id: dev_1
event_source: SOURCE_PROVIDER
event_type: COMMIT_CODE
time: 2024-01-01T04:00:00Z
time: "2024-01-01 04:00:00+00:00"
amount: 1
- to_artifact_id: repo_0
from_artifact_id: dev_1
event_source: SOURCE_PROVIDER
event_type: COMMIT_CODE
time: 2024-01-02T04:00:00Z
time: "2024-01-02 04:00:00+00:00"
amount: 1
outputs:
query:
Expand Down
2 changes: 1 addition & 1 deletion warehouse/metrics_tools/factory/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ruff: noqa: F403

from .factory import *
from ..definition import *
from .factory import *
35 changes: 35 additions & 0 deletions warehouse/metrics_tools/factory/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import typing as t

from sqlglot import exp

TIME_AGGREGATION_TO_CRON = {
"daily": "@daily",
"monthly": "@monthly",
"weekly": "@weekly",
}
METRICS_COLUMNS_BY_ENTITY: t.Dict[str, t.Dict[str, exp.DataType]] = {
"artifact": {
"metrics_sample_date": exp.DataType.build("DATE", dialect="duckdb"),
"event_source": exp.DataType.build("STRING", dialect="duckdb"),
"to_artifact_id": exp.DataType.build("STRING", dialect="duckdb"),
"from_artifact_id": exp.DataType.build("STRING", dialect="duckdb"),
"metric": exp.DataType.build("STRING", dialect="duckdb"),
"amount": exp.DataType.build("DOUBLE", dialect="duckdb"),
},
"project": {
"metrics_sample_date": exp.DataType.build("DATE", dialect="duckdb"),
"event_source": exp.DataType.build("STRING", dialect="duckdb"),
"to_project_id": exp.DataType.build("STRING", dialect="duckdb"),
"from_artifact_id": exp.DataType.build("STRING", dialect="duckdb"),
"metric": exp.DataType.build("STRING", dialect="duckdb"),
"amount": exp.DataType.build("DOUBLE", dialect="duckdb"),
},
"collection": {
"metrics_sample_date": exp.DataType.build("DATE", dialect="duckdb"),
"event_source": exp.DataType.build("STRING", dialect="duckdb"),
"to_collection_id": exp.DataType.build("STRING", dialect="duckdb"),
"from_artifact_id": exp.DataType.build("STRING", dialect="duckdb"),
"metric": exp.DataType.build("STRING", dialect="duckdb"),
"amount": exp.DataType.build("DOUBLE", dialect="duckdb"),
},
}
Loading
Loading