Skip to content

Commit

Permalink
Fix metrics for active days (#2270)
Browse files Browse the repository at this point in the history
* Fix model creation

* Fixes "active_days" metric

* Upgrade to sqlmesh 0.125.0
  • Loading branch information
ravenac95 authored Sep 28, 2024
1 parent bc37ba7 commit 507fae8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 22 deletions.
26 changes: 11 additions & 15 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ sqlalchemy = "^2.0.25"
textual = "^0.52.1"
redis = "^5.0.7"
githubkit = "^0.11.6"
sqlmesh = { git = "https://github.com/opensource-observer/sqlmesh.git", rev = "test-clickhouse-engine-updates", extras = [
"gcppostgres",
] }
sqlmesh = "0.125.0"
dagster-duckdb = "^0.24.0"
dagster-duckdb-polars = "^0.24.0"
google-cloud-bigquery-storage = "^2.25.0"
Expand Down
2 changes: 1 addition & 1 deletion warehouse/metrics_mesh/oso_metrics/active_days.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
select @metrics_sample_date(events.bucket_day) as metrics_sample_date,
events.event_source,
events.to_artifact_id,
'' as from_artifact_id,
events.from_artifact_id as from_artifact_id,
@metric_name() as metric,
COUNT(DISTINCT events.bucket_day) amount
from metrics.events_daily_to_artifact as events
Expand Down
6 changes: 3 additions & 3 deletions warehouse/metrics_tools/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import inspect
import logging
import re
import textwrap
import typing as t
from pathlib import Path
Expand Down Expand Up @@ -328,7 +329,7 @@ def model(
jinja_macros: t.Optional[JinjaMacroRegistry] = None,
dialect: t.Optional[str] = None,
time_column_format: str = c.DEFAULT_TIME_COLUMN_FORMAT,
physical_schema_override: t.Optional[t.Dict[str, str]] = None,
physical_schema_mapping: t.Optional[t.Dict[re.Pattern, str]] = None,
project: str = "",
default_catalog: t.Optional[str] = None,
variables: t.Optional[t.Dict[str, t.Any]] = None,
Expand All @@ -349,7 +350,7 @@ def model(
defaults=defaults,
path=fake_module_path,
time_column_format=time_column_format,
physical_schema_override=physical_schema_override,
physical_schema_mapping=physical_schema_mapping,
project=project,
default_catalog=default_catalog,
variables=variables,
Expand All @@ -362,7 +363,6 @@ def model(
source = self.source_loader()
assert source is not None, "source cannot be empty"

# env = macros.copy()
env = {}

entrypoint_name, env = create_import_call_env(
Expand Down

0 comments on commit 507fae8

Please sign in to comment.