Skip to content

Commit

Permalink
Fix regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
Firman, Max committed Sep 29, 2023
1 parent 4454abf commit 99301ea
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 18 deletions.
4 changes: 2 additions & 2 deletions macros/upload_individual_datasets/upload_model_executions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@
'{{ model.status }}', {# status #}

{% 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 #}
{% if compile_started_at %}{{ dbt_artifacts.cast_as_timestamp(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 #}
{% if query_completed_at %}{{ dbt_artifacts.cast_as_timestamp(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
54 changes: 40 additions & 14 deletions macros/upload_individual_datasets/upload_seed_executions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -139,23 +139,49 @@
{% if models != [] %}
{% set model_values %}
{% for model in models -%}
{% do model.pop('raw_code', None) %}
(
'{{ invocation_id }}', {# command_invocation_id #}
'{{ model.unique_id }}', {# node_id #}
'{{ model.node.unique_id }}', {# node_id #}
{{ dbt_artifacts.cast_as_timestamp(run_started_at) }}, {# run_started_at #}
'{{ model.database }}', {# database #}
'{{ model.schema }}', {# schema #}
'{{ model.name }}', {# name #}
'{{ dbt_artifacts.escape_string(tojson(model.depends_on.nodes)) }}', {# depends_on_nodes #}
'{{ model.package_name }}', {# package_name #}
'{{ dbt_artifacts.escape_string(model.original_file_path) }}', {# path #}
'{{ model.checksum.checksum }}', {# checksum #}
'{{ model.config.materialized }}', {# materialization #}
'{{ tojson(model.tags) }}', {# tags #}
'{{ dbt_artifacts.escape_string(tojson(model.config.meta)) }}', {# meta #}
'{{ model.alias }}', {# alias #}
'{{ dbt_artifacts.escape_string(tojson(model)) }}' {# all_results #}

{% set config_full_refresh = model.node.config.full_refresh %}
{% if config_full_refresh is none %}
{% set config_full_refresh = flags.FULL_REFRESH %}
{% endif %}
'{{ config_full_refresh }}', {# was_full_refresh #}

'{{ model.thread_id }}', {# thread_id #}
'{{ model.status }}', {# status #}

{% if model.timing != [] %}
{% for stage in model.timing if stage.name == "compile" %}
{% if loop.length == 0 %}
null, {# 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 %}
null, {# query_completed_at #}
{% else %}
{{ dbt_artifacts.cast_as_timestamp(stage.completed_at) }}, {# query_completed_at #}
{% endif %}
{% endfor %}
{% else %}
null, {# compile_started_at #}
null, {# query_completed_at #}
{% endif %}

{{ model.execution_time }}, {# total_node_runtime #}
null, -- rows_affected not available {# Only available in Snowflake #}
'{{ model.node.config.materialized }}', {# materialization #}
'{{ model.node.schema }}', {# schema #}
'{{ model.node.name }}', {# name #}
'{{ model.node.alias }}', {# alias #}
'{{ dbt_artifacts.escape_string(model.message) }}', {# message #}
'{{ dbt_artifacts.escape_string(tojson(model.adapter_response)) }}' {# adapter_response #}
)
{%- if not loop.last %},{%- endif %}
{%- endfor %}
Expand Down
4 changes: 2 additions & 2 deletions macros/upload_results/insert_into_metadata_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@

{%- endmacro %}

{% macro dremio__insert_into_metadata_table(database_name, schema_name, table_name, content) -%}
{% macro dremio__insert_into_metadata_table(relation, fields, content) -%}
{% set insert_into_table_query %}
insert into {{ relation }} {{ fields }}
insert into {{ relation }}
values
{{ content }}
{% endset %}
Expand Down

0 comments on commit 99301ea

Please sign in to comment.