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

Ele 3382 generate report memory fixes #1634

Merged
merged 2 commits into from
Jul 11, 2024
Merged
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
2 changes: 1 addition & 1 deletion elementary/clients/dbt/api_dbt_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def _inner_run_command(
dbt_logs = []

def collect_dbt_command_logs(event):
event_dump = json.dumps(MessageToDict(event)) # type: ignore[arg-type]
if event.info.name == "JinjaLogInfo":
event_dump = json.dumps(MessageToDict(event)) # type: ignore[arg-type]
dbt_logs.append(event_dump)

with env_vars_context(self.env_vars):
Expand Down
7 changes: 5 additions & 2 deletions elementary/monitor/dbt_project/macros/get_models_runs.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{%- macro get_models_runs(days_back = 7, exclude_elementary=false) -%}
{% set models_runs_query %}
with model_runs as (
select * from {{ ref('elementary', 'model_run_results') }}
select
*,
rank() over (partition by unique_id order by generated_at desc) as invocations_rank_index
from {{ ref('elementary', 'model_run_results') }}
)

select
Expand All @@ -16,7 +19,7 @@
end as execution_time,
full_refresh,
materialization,
compiled_code,
case when invocations_rank_index = 1 then compiled_code else NULL end as compiled_code,
generated_at
from model_runs
where {{ elementary.edr_datediff(elementary.edr_cast_as_timestamp('generated_at'), elementary.edr_current_timestamp(), 'day') }} < {{ days_back }}
Expand Down
2 changes: 1 addition & 1 deletion elementary/monitor/dbt_project/macros/get_test_results.sql
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
model_tags,
meta,
model_meta,
test_results_query,
case when invocations_rank_index = 1 then test_results_query else NULL end as test_results_query,
other,
test_name,
test_params,
Expand Down
Loading