Skip to content

Commit

Permalink
fix: update database
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Sep 20, 2024
1 parent 6fea9a1 commit 1091f8c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions tutoraspects/asset_command_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,11 @@ def process(self, content: dict, existing: dict):
if not metric.get("verbose_name"):
metric["verbose_name"] = metric["metric_name"].replace("_", " ").title()

content["sql"] = format_string(
content["sql"], mode=Mode(dialect_name="clickhouse")
) if "filter indent" not in content["sql"] else content["sql"]
content["sql"] = (
format_string(content["sql"], mode=Mode(dialect_name="clickhouse"))
if "filter indent" not in content["sql"]
else content["sql"]
)


class DatabaseAsset(Asset):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
with
recent_activity as (
select course_key, COUNT(DISTINCT actor_id) as active_last_7_days
from {{ DBT_PROFILE_TARGET_DATABASE }}.`navigation_events`
from {{ ASPECTS_XAPI_DATABASE }}.navigation_events
where emission_time >= NOW() - INTERVAL 7 DAY
group by course_key
)

select fss.*, COALESCE(ra.active_last_7_days, 0) as active_within_last_7_days
from {{ DBT_PROFILE_TARGET_DATABASE }}`fact_student_status` fss
from {{ DBT_PROFILE_TARGET_DATABASE }}.fact_student_status fss
left join recent_activity ra on fss.course_key = ra.course_key

0 comments on commit 1091f8c

Please sign in to comment.