@@ -692,6 +692,7 @@ def __init__(self, source: DatabaseConfig, config: SamplerConfig) -> None:
692
692
self .compact_columns : Dict [Tuple [str , str ], Set [str ]] = {}
693
693
self .temp_tables = TempTableCreator ()
694
694
self .passthrough_tables : Set [str ] = set ()
695
+ self .cached_table_sizes : Dict [Tuple [str , str ], int ] = {}
695
696
696
697
def sample (
697
698
self ,
@@ -866,6 +867,7 @@ def _materialize_tables(
866
867
primary_key = table .primary_key ,
867
868
)
868
869
)
870
+ self .cached_table_sizes [(schema , table_name )] = rowcount
869
871
LOGGER .info (
870
872
"Materialized %d rows for %s.%s in temporary table" ,
871
873
rowcount ,
@@ -1005,9 +1007,9 @@ def _copy_results(
1005
1007
1006
1008
rows = 0
1007
1009
1008
- def _count_rows (result ):
1010
+ def _count_rows (result , total : Optional [ int ] ):
1009
1011
nonlocal rows
1010
- for row in tqdm (result , desc = "row progress" , unit = "rows" ):
1012
+ for row in tqdm (result , total = total , desc = "row progress" , unit = "rows" ):
1011
1013
# result_processor
1012
1014
rows += 1
1013
1015
yield row
@@ -1017,7 +1019,7 @@ def _count_rows(result):
1017
1019
schema ,
1018
1020
table_name ,
1019
1021
columns ,
1020
- _count_rows (result ),
1022
+ _count_rows (result , self . cached_table_sizes . get (( schema , table_name )) ),
1021
1023
filter_view = filter_view ,
1022
1024
multiplier = (
1023
1025
1
0 commit comments