Skip to content

Commit 5ead946

Browse files
authored
Merge pull request #52 from Cosmo-Tech/AFOS/0.9.4
0.9.4
2 parents 3ef2df5 + 0ef4b01 commit 5ead946

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Copyright (C) - 2023 - 2025 - Cosmo Tech
22
# Licensed under the MIT license.
33

4-
__version__ = '0.9.3'
4+
__version__ = '0.9.4'

cosmotech/coal/utils/postgresql.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from typing import Optional
99
from urllib.parse import quote
1010

11+
import adbc_driver_manager
1112
import pyarrow as pa
1213
from adbc_driver_postgresql import dbapi
1314
from pyarrow import Table
@@ -66,18 +67,11 @@ def get_postgresql_table_schema(
6667

6768
with (dbapi.connect(postgresql_full_uri) as conn):
6869
try:
69-
catalog = conn.adbc_get_objects(depth="tables",
70-
catalog_filter=postgres_db,
71-
db_schema_filter=postgres_schema,
72-
table_name_filter=target_table_name).read_all().to_pylist()[0]
73-
schema = catalog["catalog_db_schemas"][0]
74-
table = schema["db_schema_tables"][0]
75-
if table["table_name"] == target_table_name:
76-
return conn.adbc_get_table_schema(
77-
target_table_name,
78-
db_schema_filter=postgres_schema,
79-
)
80-
except IndexError:
70+
return conn.adbc_get_table_schema(
71+
target_table_name,
72+
db_schema_filter=postgres_schema,
73+
)
74+
except adbc_driver_manager.ProgrammingError:
8175
LOGGER.warning(f"Table {postgres_schema}.{target_table_name} not found")
8276
return None
8377

0 commit comments

Comments
 (0)