@@ -691,6 +691,7 @@ def __init__(self, source: DatabaseConfig, config: SamplerConfig) -> None:
691
691
self .source_engine = source .database_engine (env_prefix = "SUBSET_SOURCE_" )
692
692
self .compact_columns : Dict [Tuple [str , str ], Set [str ]] = {}
693
693
self .temp_tables = TempTableCreator ()
694
+ self .passthrough_tables : Set [str ] = set ()
694
695
695
696
def sample (
696
697
self ,
@@ -699,6 +700,7 @@ def sample(
699
700
truncate : bool = False ,
700
701
create : bool = False ,
701
702
) -> None :
703
+ self .passthrough_tables = set (plan .passthrough )
702
704
meta , _ = DatabaseMetadata .from_engine (self .source_engine , list (plan .queries ))
703
705
if self .config .infer_foreign_keys != "none" :
704
706
meta .infer_missing_foreign_keys (
@@ -740,6 +742,11 @@ def _get_compact_columns(
740
742
"Table %s has columns configured for compaction but is not found" ,
741
743
table ,
742
744
)
745
+ elif table in self .passthrough_tables :
746
+ LOGGER .warning (
747
+ "Cannot compact columns on passthrough table %s" ,
748
+ table ,
749
+ )
743
750
else :
744
751
compact_columns [table_key ] = set (cols )
745
752
@@ -752,6 +759,8 @@ def _get_compact_columns(
752
759
for table_key , table_meta in meta .tables .items ():
753
760
if len (table_meta .primary_key ) != 1 :
754
761
continue
762
+ if f"{ table_key [0 ]} .{ table_key [1 ]} " in self .passthrough_tables :
763
+ continue
755
764
756
765
col = table_meta .table_obj .columns [table_meta .primary_key [0 ]]
757
766
if not issubclass (col .type .python_type , int ): # type: ignore
0 commit comments