From 5d62ac92005c33d38a1b11b55a9b3f3d5c31ff4e Mon Sep 17 00:00:00 2001 From: Peter <69901051+PeterDKay@users.noreply.github.com> Date: Thu, 13 Jul 2023 17:23:10 +0100 Subject: [PATCH] Bugfix to dialect for describe table - has_table did not include schema in the 'DESCRIBE TABLE" SQL. - This is now included. And allows the alembic_version table to be stored within different schemas to default. --- src/databricks/sqlalchemy/dialect/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/databricks/sqlalchemy/dialect/__init__.py b/src/databricks/sqlalchemy/dialect/__init__.py index 03420f2c..6a23de75 100644 --- a/src/databricks/sqlalchemy/dialect/__init__.py +++ b/src/databricks/sqlalchemy/dialect/__init__.py @@ -287,7 +287,7 @@ def has_table(self, connection, table_name, schema=None, **kwargs) -> bool: DBR_GT_12_NOT_FOUND_STRING = "TABLE_OR_VIEW_NOT_FOUND" try: - res = connection.execute(f"DESCRIBE TABLE {table_name}") + res = connection.execute(f"DESCRIBE TABLE `{schema}`.{table_name}") return True except DatabaseError as e: if DBR_GT_12_NOT_FOUND_STRING in str(