Skip to content

Commit

Permalink
Fix table-description storage
Browse files Browse the repository at this point in the history
  • Loading branch information
jcjc712 committed Apr 24, 2024
1 parent 8493438 commit ef9e4e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions dataherald/db_scanner/repository/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
5 changes: 5 additions & 0 deletions dataherald/db_scanner/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
)
)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand All @@ -319,6 +323,7 @@ def scan(
table_name=table,
status=TableDescriptionStatus.FAILED.value,
error_message=f"{e}",
schema_name=table.schema_name,
)
)
try:
Expand Down

0 comments on commit ef9e4e6

Please sign in to comment.