cancel
Showing results for 
Search instead for 
Did you mean: 
Get Started Discussions
Start your journey with Databricks by joining discussions on getting started guides, tutorials, and introductory topics. Connect with beginners and experts alike to kickstart your Databricks experience.
cancel
Showing results for 
Search instead for 
Did you mean: 

[TABLE_OR_VIEW_ALREADY_EXISTS] when running create or replace view

claudiazi
New Contributor II

When I'm running `dbt run -s model` for different models in parallel on databricks general compute cluster. Im getting the error: TABLE_OR_VIEW_ALREADY_EXISTS. Also, at the same time, the view/table was not created at all.

But I run them in sequence, then no such error will show.

Any idea what is causing this?

1 ACCEPTED SOLUTION

Accepted Solutions

raphaelblg
Databricks Employee
Databricks Employee

@claudiazi from what we've discussed so far I see no reason for the failure. 

Not sure if this error is something the community can help with but maybe opening a support ticket through https://help.databricks.com/s/ might be a good idea.

Where's this query being submitted? Interactive cluster, SQL Warehouse, dbt?

 

Best regards,

Raphael Balogo
Sr. Technical Solutions Engineer
Databricks

View solution in original post

5 REPLIES 5

raphaelblg
Databricks Employee
Databricks Employee

Hi @claudiazi,

It's hard to determine the exact root cause of the issue, but there's a known issue that could lead to the same error. 

If you check CREATE TABLE [USING] - Parameters. You'll be able to see the following note:

 

Databricks strongly recommends using REPLACE instead of dropping and re-creating Delta Lake tables.

This is because the pattern of deleting and creating Delta Lake tables without the REPLACE clause might not clean-up all the metadata files right away. 

 

Best regards,

Raphael Balogo
Sr. Technical Solutions Engineer
Databricks

claudiazi
New Contributor II

@raphaelblg thaanks a lot for your reply! However the command were `create or replace view/table` Thats why I'm very surprised that we are getting this error message 🤔🤔🤔

 

raphaelblg
Databricks Employee
Databricks Employee

@claudiazi Are you the owner of the view?

 

Best regards,

Raphael Balogo
Sr. Technical Solutions Engineer
Databricks

claudiazi
New Contributor II

@raphaelblg yes! Im the owner. However, these views are inside the hive_metastore catalog. Could it be the reason?
Many thaaanks!

raphaelblg
Databricks Employee
Databricks Employee

@claudiazi from what we've discussed so far I see no reason for the failure. 

Not sure if this error is something the community can help with but maybe opening a support ticket through https://help.databricks.com/s/ might be a good idea.

Where's this query being submitted? Interactive cluster, SQL Warehouse, dbt?

 

Best regards,

Raphael Balogo
Sr. Technical Solutions Engineer
Databricks

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now