From ef9e4e628a634ed066d415d8eff3b03b7b36fc8d Mon Sep 17 00:00:00 2001 From: Juan Carlos Jose Camacho Date: Wed, 24 Apr 2024 11:45:44 -0600 Subject: [PATCH] Fix table-description storage --- dataherald/db_scanner/repository/base.py | 1 + dataherald/db_scanner/sqlalchemy.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/dataherald/db_scanner/repository/base.py b/dataherald/db_scanner/repository/base.py index 7e6cf3da..c3656d44 100644 --- a/dataherald/db_scanner/repository/base.py +++ b/dataherald/db_scanner/repository/base.py @@ -59,6 +59,7 @@ def save_table_info(self, table_info: TableDescription) -> TableDescription: { "db_connection_id": table_info_dict["db_connection_id"], "table_name": table_info_dict["table_name"], + "schema_name": table_info_dict["schema_name"], }, table_info_dict, ) diff --git a/dataherald/db_scanner/sqlalchemy.py b/dataherald/db_scanner/sqlalchemy.py index 6511e32e..2d3da7ca 100644 --- a/dataherald/db_scanner/sqlalchemy.py +++ b/dataherald/db_scanner/sqlalchemy.py @@ -112,6 +112,7 @@ def synchronizing( table_name=table_description.table_name, status=TableDescriptionStatus.SYNCHRONIZING.value, metadata=scanner_request.metadata, + schema_name=table_description.schema_name, ) ) ) @@ -241,6 +242,7 @@ def scan_single_table( db_connection_id: str, repository: TableDescriptionRepository, scanner_service: AbstractScanner, + schema: str | None = None, ) -> TableDescription: print(f"Scanning table: {table}") inspector = inspect(db_engine.engine) @@ -273,6 +275,7 @@ def scan_single_table( last_schema_sync=datetime.now(), error_message="", status=TableDescriptionStatus.SCANNED.value, + schema_name=schema, ) repository.save_table_info(object) @@ -311,6 +314,7 @@ def scan( db_connection_id=table.db_connection_id, repository=repository, scanner_service=scanner_service, + schema=table.schema_name, ) except Exception as e: repository.save_table_info( @@ -319,6 +323,7 @@ def scan( table_name=table, status=TableDescriptionStatus.FAILED.value, error_message=f"{e}", + schema_name=table.schema_name, ) ) try: