- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2019 05:46 AM
I agree about this being a usability bug. Documentation clearly states that if the optional flag "IF EXISTS" is provided that the statement will do nothing.
https://docs.databricks.com/spark/latest/spark-sql/language-manual/drop-table.html
Drop Table copy
DROP TABLE [IF EXISTS] [db_name.]table_nameDrop a table and delete the directory associated with the table from the file system if this is not an
EXTERNALtable. If the table to drop does not exist, an exception is thrown.
IF EXISTSIf the table does not exist, nothing happens.
I am getting the same error as the original post while running the just this command with the SQL API
DROP TABLE IF EXISTS testTable;
I would expect no error but get the following.
Error in SQL statement: AnalysisException: Table or view 'testTable' not found in database 'null';; DropTableCommand
testTable, true, false, false