Skip to content

Commit

Permalink
Bug squashing
Browse files Browse the repository at this point in the history
  • Loading branch information
Gemma Down committed Sep 29, 2023
1 parent f67042b commit 4454abf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
24 changes: 4 additions & 20 deletions macros/upload_individual_datasets/upload_model_executions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -122,26 +122,10 @@
'{{ model.thread_id }}', {# thread_id #}
'{{ model.status }}', {# status #}

{% if model.timing != [] %}
{% for stage in model.timing if stage.name == "compile" %}
{% if loop.length == 0 %}
cast(null as timestamp), {# compile_started_at #}
{% else %}
{{ dbt_artifacts.cast_as_timestamp(stage.started_at) }}, {# compile_started_at #}
{% endif %}
{% endfor %}

{% for stage in model.timing if stage.name == "execute" %}
{% if loop.length == 0 %}
cast(null as timestamp), {# query_completed_at #}
{% else %}
{{ dbt_artifacts.cast_as_timestamp(stage.completed_at) }}, {# query_completed_at #}
{% endif %}
{% endfor %}
{% else %}
cast(null as timestamp), {# compile_started_at #}
cast(null as timestamp), {# query_completed_at #}
{% endif %}
{% set compile_started_at = (model.timing | selectattr("name", "eq", "compile") | first | default({}))["started_at"] %}
{% if compile_started_at %}'{{ compile_started_at }}'{% else %}cast(null as timestamp){% endif %}, {# compile_started_at #}
{% set query_completed_at = (model.timing | selectattr("name", "eq", "execute") | first | default({}))["completed_at"] %}
{% if query_completed_at %}'{{ query_completed_at }}'{% else %}cast(null as timestamp){% endif %}, {# query_completed_at #}

cast({{ model.execution_time }} as float), {# total_node_runtime #}
null, -- rows_affected not available {# Only available in Snowflake & BigQuery #}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
{% endif %}
{% endmacro -%}

{% macro dremio__get_models_dml_sql(models) -%}
{% macro dremio__get_seed_executions_dml_sql(models) -%}

{% if models != [] %}
{% set model_values %}
Expand Down

0 comments on commit 4454abf

Please sign in to comment.