Dbt: _tmp relation name should be based on model name, not on alias (or be schema prefixed)

Created on 27 Feb 2019  路  4Comments  路  Source: fishtown-analytics/dbt

Issue

in multi-threaded mode, 'dbt run' fails when two models share the same alias on distinct schemas, because the temporary tables share the same name for both models.

Issue description

model1.sql : schema = schema1, alias = my_model
model2.sql : schema = schema2, alias = my_model

in profile.yml : threads >= 2

dbt run might fail with the following error :

"ERROR : my_model__dbt_incremental_tmp already exists"

Results

running 'dbt run' again might work without issue, depending on the models processing order.

System information

dbt v0.12.2

bug redshifpg

Most helpful comment

my fault, did not mention we are working on postgres !

DBT is an incredible tool, thank you for providing us with such a powerful ELT engine !

regards from France

All 4 comments

@fetanchaud thanks for the report! Did you see this on postgres/redshift? Using the model name instead of the alias is a good idea :)

my fault, did not mention we are working on postgres !

DBT is an incredible tool, thank you for providing us with such a powerful ELT engine !

regards from France

Fixed in #1342

@beckjake I thought I had broken this in https://github.com/fishtown-analytics/dbt/pull/1478

but it turns out that we added a timestamp to the end of the temp relation name to fix other unrelated issues with temp tables on postgres/redshift. So, all good here i think

Was this page helpful?
0 / 5 - 0 ratings