032: fix missing awaits in translate datasource endpoints (#5,6,7)

Three sync functions called async SupersetClient methods without await:
  - get_datasource_columns(): get_dataset_detail + get_database (async)
  - fetch_available_datasources(): get_datasets (async)
  - Route handlers: both calls missing await

Converted to async functions + added awaits. Both endpoints now return
proper data instead of coroutine errors.
This commit is contained in:
2026-06-04 23:57:46 +03:00
parent fe2602dc89
commit f6dc7c47e7
3 changed files with 7 additions and 7 deletions

View File

@@ -114,7 +114,7 @@ def detect_virtual_columns(columns: list[dict[str, Any]]) -> list[str]:
# #region get_datasource_columns [C:3] [TYPE Function]
# @BRIEF Fetch datasource column metadata from Superset and return structured response.
def get_datasource_columns(
async def get_datasource_columns(
datasource_id: int,
env_id: str,
config_manager: ConfigManager,
@@ -128,7 +128,7 @@ def get_datasource_columns(
raise ValueError(f"Superset environment '{env_id}' not found")
client = SupersetClient(env_config)
dataset_detail = client.get_dataset_detail(datasource_id)
dataset_detail = await client.get_dataset_detail(datasource_id)
database_info = dataset_detail.get("database", {})
dialect = None
@@ -140,7 +140,7 @@ def get_datasource_columns(
if dialect is None:
database_id = dataset_detail.get("database_id")
if database_id:
db_record = client.get_database(int(database_id))
db_record = await client.get_database(int(database_id))
db_result = db_record.get("result", db_record) if isinstance(db_record, dict) else db_record
dialect = get_dialect_from_database(db_result)
else: