Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DH-4735 Fix table-descriptions rows query #186

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dataherald/db_scanner/repository/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def get_table_info(
return TableSchemaDetail(**row)
return None

def get_all_tables_by_db(self, db_connection_id: str) -> List[TableSchemaDetail]:
rows = self.storage.find(DB_COLLECTION, {"db_connection_id": db_connection_id})
def get_all_tables_by_db(self, query: dict) -> List[TableSchemaDetail]:
rows = self.storage.find(DB_COLLECTION, query)
tables = []
for row in rows:
row["id"] = row["_id"]
Expand Down
6 changes: 4 additions & 2 deletions dataherald/sql_generator/dataherald_sqlagent.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,10 @@ def generate_response(
)
repository = DBScannerRepository(storage)
db_scan = repository.get_all_tables_by_db(
db_connection_id=database_connection.id,
status=TableDescriptionStatus.SYNCHRONIZED.value,
{
"db_connection_id": str(database_connection.id),
"status": TableDescriptionStatus.SYNCHRONIZED.value,
}
)
if not db_scan:
raise ValueError("No scanned tables found for database")
Expand Down