This repository was archived by the owner on May 17, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
data_diff/sqeleton/databases Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -339,8 +339,6 @@ def select_table_schema(self, path: DbPath) -> str:
339339
340340 def query_table_schema (self , path : DbPath ) -> Dict [str , tuple ]:
341341 rows = self .query (self .select_table_schema (path ), list )
342- if not rows and self .name == 'Redshift' :
343- rows = self .query (self .select_external_table_schema (path ), list )
344342 if not rows :
345343 raise RuntimeError (f"{ self .name } : Table '{ '.' .join (path )} ' does not exist, or has no columns" )
346344
Original file line number Diff line number Diff line change 1- from typing import List
1+ from typing import List , Dict
22from ..abcs .database_types import Float , TemporalType , FractionalType , DbPath
33from ..abcs .mixins import AbstractMixin_MD5
44from .postgresql import (
@@ -85,3 +85,18 @@ def select_external_table_schema(self, path: DbPath) -> str:
8585 WHERE tablename = '{ table .lower ()} ' AND schemaname = '{ schema .lower ()} '
8686 """
8787 )
88+
89+ def query_external_table_schema (self , path : DbPath ) -> Dict [str , tuple ]:
90+ rows = self .query (self .select_external_table_schema (path ), list )
91+ if not rows :
92+ raise RuntimeError (f"{ self .name } : Table '{ '.' .join (path )} ' does not exist, or has no columns" )
93+
94+ d = {r [0 ]: r for r in rows }
95+ assert len (d ) == len (rows )
96+ return d
97+
98+ def query_table_schema (self , path : DbPath ) -> Dict [str , tuple ]:
99+ try :
100+ return super ().query_table_schema (path )
101+ except RuntimeError :
102+ return self .query_external_table_schema (path )
You can’t perform that action at this time.
0 commit comments