@@ -211,6 +211,13 @@ def query_and_load(
211211 ** {k : v for k , v in kwargs .items () if k in ['max_retries' , 'retry_delay' ]},
212212 )
213213
214+ # Remove known LoadConfig params from kwargs, leaving loader-specific params
215+ for key in ['max_retries' , 'retry_delay' ]:
216+ kwargs .pop (key , None )
217+
218+ # Remaining kwargs are loader-specific (e.g., channel_suffix for Snowflake)
219+ loader_specific_kwargs = kwargs
220+
214221 if read_all :
215222 self .logger .info (f'Loading entire query result to { loader_type } :{ destination } ' )
216223 else :
@@ -221,20 +228,20 @@ def query_and_load(
221228 # Get the data and load
222229 if read_all :
223230 table = self .get_sql (query , read_all = True )
224- return self ._load_table (table , loader_type , destination , loader_config , load_config )
231+ return self ._load_table (table , loader_type , destination , loader_config , load_config , ** loader_specific_kwargs )
225232 else :
226233 batch_stream = self .get_sql (query , read_all = False )
227- return self ._load_stream (batch_stream , loader_type , destination , loader_config , load_config )
234+ return self ._load_stream (batch_stream , loader_type , destination , loader_config , load_config , ** loader_specific_kwargs )
228235
229236 def _load_table (
230- self , table : pa .Table , loader : str , table_name : str , config : Dict [str , Any ], load_config : LoadConfig
237+ self , table : pa .Table , loader : str , table_name : str , config : Dict [str , Any ], load_config : LoadConfig , ** kwargs
231238 ) -> LoadResult :
232239 """Load a complete Arrow Table"""
233240 try :
234241 loader_instance = create_loader (loader , config )
235242
236243 with loader_instance :
237- return loader_instance .load_table (table , table_name , ** load_config .__dict__ )
244+ return loader_instance .load_table (table , table_name , ** load_config .__dict__ , ** kwargs )
238245 except Exception as e :
239246 self .logger .error (f'Failed to load table: { e } ' )
240247 return LoadResult (
@@ -254,13 +261,14 @@ def _load_stream(
254261 table_name : str ,
255262 config : Dict [str , Any ],
256263 load_config : LoadConfig ,
264+ ** kwargs ,
257265 ) -> Iterator [LoadResult ]:
258266 """Load from a stream of batches"""
259267 try :
260268 loader_instance = create_loader (loader , config )
261269
262270 with loader_instance :
263- yield from loader_instance .load_stream (batch_stream , table_name , ** load_config .__dict__ )
271+ yield from loader_instance .load_stream (batch_stream , table_name , ** load_config .__dict__ , ** kwargs )
264272 except Exception as e :
265273 self .logger .error (f'Failed to load stream: { e } ' )
266274 yield LoadResult (
0 commit comments