Skip to content

Commit

Permalink
Append model.batch.id to suffix in make_temp_relation when present (
Browse files Browse the repository at this point in the history
  • Loading branch information
QMalcolm authored Dec 4, 2024
1 parent 6c41bed commit 86efa88
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dbt/include/global_project/macros/adapters/relation.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
{% endmacro %}

{% macro make_temp_relation(base_relation, suffix='__dbt_tmp') %}
{#-- This ensures microbatch batches get unique temp relations to avoid clobbering --#}
{% if suffix == '__dbt_tmp' and model.batch %}
{% set suffix = suffix ~ '_' ~ model.batch.id %}
{% endif %}

{{ return(adapter.dispatch('make_temp_relation', 'dbt')(base_relation, suffix)) }}
{% endmacro %}

Expand Down

0 comments on commit 86efa88

Please sign in to comment.