Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 9d6a2ee

Browse files
committed
forgot the query
1 parent dcc70d1 commit 9d6a2ee

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

data_diff/databases/redshift.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,15 @@ def select_svv_columns_schema(self, path: DbPath) -> Dict[str, tuple]:
146146
+ db_clause
147147
)
148148

149+
def query_svv_columns(self, path: DbPath) -> Dict[str, tuple]:
150+
rows = self.query(self.select_svv_columns_schema(path), list)
151+
if not rows:
152+
raise RuntimeError(f"{self.name}: Table '{'.'.join(path)}' does not exist, or has no columns")
153+
154+
d = {r[0]: r for r in rows}
155+
assert len(d) == len(rows)
156+
return d
157+
149158
# when using a non-information_schema source, strip (N) from type(N) etc. to match
150159
# typical information_schema output
151160
def _normalize_schema_info(self, rows) -> Dict[str, tuple]:
@@ -177,7 +186,7 @@ def query_table_schema(self, path: DbPath) -> Dict[str, tuple]:
177186
try:
178187
return self.query_pg_get_cols(path)
179188
except Exception:
180-
return self.select_svv_columns_schema(path)
189+
return self.query_svv_columns(path)
181190

182191
def _normalize_table_path(self, path: DbPath) -> DbPath:
183192
if len(path) == 1:

0 commit comments

Comments
 (0)