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

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

Closed
fetanchaud opened this issue Feb 27, 2019 · 4 comments
Assignees
Labels
bug Something isn't working redshift

Comments

@fetanchaud
Copy link

fetanchaud commented Feb 27, 2019

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

@drewbanin
Copy link
Contributor

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

@drewbanin drewbanin added bug Something isn't working redshift labels Feb 27, 2019
@drewbanin drewbanin added this to the Wilt Chamberlain milestone Feb 27, 2019
@fetanchaud
Copy link
Author

fetanchaud commented Feb 27, 2019

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

@beckjake beckjake self-assigned this Mar 8, 2019
beckjake added a commit that referenced this issue Mar 8, 2019
…rom-modelname

Prefix temp relations with model name instead of alias (#1321)
@beckjake
Copy link
Contributor

beckjake commented Mar 8, 2019

Fixed in #1342

@beckjake beckjake closed this as completed Mar 8, 2019
@drewbanin drewbanin reopened this Jun 3, 2019
@drewbanin
Copy link
Contributor

@beckjake I thought I had broken this in #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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working redshift
Projects
None yet
Development

No branches or pull requests

3 participants