From fea8beb7c3ca79951bd5962c4481eba5fce569d9 Mon Sep 17 00:00:00 2001 From: Mayur Singal <39544459+ulixius9@users.noreply.github.com> Date: Wed, 27 Nov 2024 18:38:26 +0530 Subject: [PATCH] MINOR: Databricks LocationPath Update Fix (#18815) --- ingestion/src/metadata/ingestion/models/patch_request.py | 1 + .../metadata/ingestion/source/database/databricks/metadata.py | 4 +--- ingestion/src/metadata/utils/sqlalchemy_utils.py | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/ingestion/src/metadata/ingestion/models/patch_request.py b/ingestion/src/metadata/ingestion/models/patch_request.py index ce51647717c..f7fc2236e85 100644 --- a/ingestion/src/metadata/ingestion/models/patch_request.py +++ b/ingestion/src/metadata/ingestion/models/patch_request.py @@ -94,6 +94,7 @@ ALLOWED_COMMON_PATCH_FIELDS = { "tableConstraints": True, "tablePartition": True, "location": True, + "locationPath": True, "schemaDefinition": True, "sampleData": True, "fileFormat": True, diff --git a/ingestion/src/metadata/ingestion/source/database/databricks/metadata.py b/ingestion/src/metadata/ingestion/source/database/databricks/metadata.py index b288cb00d61..31b511575b2 100644 --- a/ingestion/src/metadata/ingestion/source/database/databricks/metadata.py +++ b/ingestion/src/metadata/ingestion/source/database/databricks/metadata.py @@ -125,7 +125,7 @@ def _get_table_columns(self, connection, table_name, schema, db_name): query = DATABRICKS_GET_TABLE_COMMENTS.format( database_name=db_name, schema_name=schema, table_name=table_name ) - cursor = get_table_comment_result( + rows = get_table_comment_result( self, connection=connection, query=query, @@ -134,8 +134,6 @@ def _get_table_columns(self, connection, table_name, schema, db_name): schema=schema, ) - rows = cursor.fetchall() - except exc.OperationalError as e: # Does the table exist? regex_fmt = r"TExecuteStatementResp.*SemanticException.*Table not found {}" diff --git a/ingestion/src/metadata/utils/sqlalchemy_utils.py b/ingestion/src/metadata/utils/sqlalchemy_utils.py index 1c1e33e7687..747a8522fa4 100644 --- a/ingestion/src/metadata/utils/sqlalchemy_utils.py +++ b/ingestion/src/metadata/utils/sqlalchemy_utils.py @@ -180,7 +180,7 @@ def get_table_comment_results( """ self.table_comment_result: Dict[Tuple[str, str], str] = {} self.current_db: str = database - result = connection.execute(query) + result = connection.execute(query).fetchall() self.table_comment_result[(table_name, schema)] = result