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

[CT-622] TempTableAlreadyExistsException: Temporary view already exists #350

Closed
phillem15 opened this issue May 9, 2022 · 8 comments · Fixed by #906
Closed

[CT-622] TempTableAlreadyExistsException: Temporary view already exists #350

phillem15 opened this issue May 9, 2022 · 8 comments · Fixed by #906
Labels
wontfix This will not be worked on

Comments

@phillem15
Copy link

I have been having some issues in dbt cloud using the Databricks connection with delta merge as the incremental strategy for one of my models. The issue in the logs is "Error running query: org.apache.spark.sql.catalyst.analysis.TempTableAlreadyExistsException: Temporary view '<model_name>__dbt_tmp' already exists'.

I believe this may be caused by the following line of code saying 'create temporary view' rather than 'create or replace temporary view'. I have only been able to re-create this issue when running a different job on the same model. For example, we run a separate job instance in dbt cloud for hotfixes, rather than a full job run.

create temporary view {{ relation.include(schema=false) }} as

@github-actions github-actions bot changed the title TempTableAlreadyExistsException: Temporary view already exists [CT-622] TempTableAlreadyExistsException: Temporary view already exists May 9, 2022
@jtcohen6 jtcohen6 added bug Something isn't working triage labels May 10, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2022

This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue, or it will be closed in 7 days.

@github-actions github-actions bot added the Stale label Nov 7, 2022
@InbarShirizly
Copy link

I have been having some issues in dbt cloud using the Databricks connection with delta merge as the incremental strategy for one of my models. The issue in the logs is "Error running query: org.apache.spark.sql.catalyst.analysis.TempTableAlreadyExistsException: Temporary view '<model_name>__dbt_tmp' already exists'.

I believe this may be caused by the following line of code saying 'create temporary view' rather than 'create or replace temporary view'. I have only been able to re-create this issue when running a different job on the same model. For example, we run a separate job instance in dbt cloud for hotfixes, rather than a full job run.

create temporary view {{ relation.include(schema=false) }} as

something similar is happening to me, did you resolve it? @phillem15

@github-actions github-actions bot removed the Stale label Nov 15, 2022
@Fleid
Copy link
Contributor

Fleid commented Feb 11, 2023

Hi @phillem15, @InbarShirizly - if you are targeting Databricks on dbt Cloud, the best is to use the dbt-databricks connection released since last November. A migration guide is available.

Which means that this should be solved not on dbt-spark but dbt-databricks (issues).

I'm closing this for now (until we hear from Spark users).

@Fleid Fleid closed this as completed Feb 11, 2023
@Fleid Fleid added wontfix This will not be worked on and removed bug Something isn't working triage labels Feb 11, 2023
@data-blade
Copy link

data-blade commented Sep 1, 2023

hi @Fleid, spark users here, since still not fixed on dbt-spark. can we please re-open this? is it as easy as adding or replace to that line?

@shabbirk-db
Copy link

shabbirk-db commented Sep 7, 2023

We really should fix this issue in dbt-spark because dbt-databricks continues to have dependencies to dbt-spark.
Macros in dbt-databricks like this one:
https://github.com/databricks/dbt-databricks/blob/0bedfd5be0355d504845a55e10dc849cbc6cc2e6/dbt/include/databricks/macros/adapters.sql#L69

They call the create temporary view macro themselves and so the same issue continues to present itself even for dbt-databricks users.

@data-blade
Copy link

pinging @dataders for help

@data-blade
Copy link

also @colin-rogers-dbt. apologies for pinging 3 maintainers.

@colin-rogers-dbt
Copy link
Contributor

Re-opening as this does seem applicable to dbt-spark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
7 participants