โ06-19-2023 12:28 AM
what is the equivalent of "IF EXISTS" in databricks? I would like to first check something later after that use the insert into statement.
โ06-19-2023 06:54 AM
Hi @Givi Saluโ ,
IF EXISTS - If specified, no TABLE_OR_VIEW_NOT_FOUND error is thrown when the table does not exist.
DROP TABLE IF EXISTS employeetable;
โ06-19-2023 06:54 AM
Hi @Givi Saluโ ,
IF EXISTS - If specified, no TABLE_OR_VIEW_NOT_FOUND error is thrown when the table does not exist.
DROP TABLE IF EXISTS employeetable;
โ06-19-2023 11:03 PM
Hi @Givi Saluโ
We haven't heard from you since the last response from @Ajay Pandeyโ โ, and I was checking back to see if her suggestions helped you.
Or else, If you have any solution, please share it with the community, as it can be helpful to others.
Also, Please don't forget to click on the "Select As Best" button whenever the information provided helps resolve your question.
โ11-16-2023 02:39 PM
Is there a way to check if a table exists, without trying to drop it? something like :
select table_name from system_catalogs where database_name = 'mydb' and schema_name = 'myschema' and object_name = 'mytab';
โ12-08-2023 10:06 AM
You can query `system.information_schema.tables` which includes all existing tables in the metastore. More on information schema: https://docs.databricks.com/en/sql/language-manual/sql-ref-information-schema.html
Passionate about hosting events and connecting people? Help us grow a vibrant local communityโsign up today to get started!
Sign Up Now