@@ -231,7 +231,7 @@ async def test_write_pandas_with_overwrite(
231231)
232232@pytest .mark .parametrize ("quote_identifiers" , [True , False ])
233233@pytest .mark .parametrize ("auto_create_table" , [True , False ])
234- @pytest .mark .parametrize ("create_temp_table " , [True , False ])
234+ @pytest .mark .parametrize ("table_type " , ["temp" , "" ])
235235@pytest .mark .parametrize ("index" , [False ])
236236async def test_write_pandas (
237237 conn_cnx : Callable [..., Generator [SnowflakeConnection ]],
@@ -240,7 +240,7 @@ async def test_write_pandas(
240240 chunk_size : int ,
241241 quote_identifiers : bool ,
242242 auto_create_table : bool ,
243- create_temp_table : bool ,
243+ table_type : str ,
244244 index : bool ,
245245):
246246 num_of_chunks = math .ceil (len (sf_connector_version_data ) / chunk_size )
@@ -275,7 +275,7 @@ async def test_write_pandas(
275275 chunk_size = chunk_size ,
276276 quote_identifiers = quote_identifiers ,
277277 auto_create_table = auto_create_table ,
278- create_temp_table = create_temp_table ,
278+ table_type = table_type ,
279279 index = index ,
280280 )
281281
@@ -297,7 +297,9 @@ async def test_write_pandas(
297297 )
298298 ).fetchall ()
299299 assert table_info [0 ]["kind" ] == (
300- "TEMPORARY" if create_temp_table else "TABLE"
300+ "TEMPORARY"
301+ if table_type .lower () in ("temp" , "temporary" )
302+ else "TABLE"
301303 )
302304 finally :
303305 await cnx .execute_string (drop_sql )
@@ -311,7 +313,7 @@ async def test_write_non_range_index_pandas(
311313 chunk_size = 3
312314 quote_identifiers : bool = False
313315 auto_create_table : bool = True
314- create_temp_table : bool = False
316+ table_type : str = ""
315317 index : bool = False
316318
317319 # use pandas dataframe with float index
@@ -356,7 +358,7 @@ async def test_write_non_range_index_pandas(
356358 chunk_size = chunk_size ,
357359 quote_identifiers = quote_identifiers ,
358360 auto_create_table = auto_create_table ,
359- create_temp_table = create_temp_table ,
361+ table_type = table_type ,
360362 index = index ,
361363 )
362364
@@ -376,7 +378,9 @@ async def test_write_non_range_index_pandas(
376378 )
377379 ).fetchall ()
378380 assert table_info [0 ]["kind" ] == (
379- "TEMPORARY" if create_temp_table else "TABLE"
381+ "TEMPORARY"
382+ if table_type .lower () in ("temp" , "temporary" )
383+ else "TABLE"
380384 )
381385 finally :
382386 await cnx .execute_string (drop_sql )
@@ -413,31 +417,6 @@ async def test_write_pandas_table_type(
413417 await cnx .execute_string (drop_sql )
414418
415419
416- async def test_write_pandas_create_temp_table_deprecation_warning (
417- conn_cnx : Callable [..., Generator [SnowflakeConnection ]],
418- ):
419- async with conn_cnx () as cnx :
420- table_name = random_string (5 , "driver_versions_" )
421- drop_sql = f"DROP TABLE IF EXISTS { table_name } "
422- try :
423- with pytest .deprecated_call (match = "create_temp_table is deprecated" ):
424- success , _ , _ , _ = await write_pandas (
425- cnx ,
426- sf_connector_version_df .get (),
427- table_name ,
428- create_temp_table = True ,
429- auto_create_table = True ,
430- )
431-
432- assert success
433- table_info = await (
434- await cnx .cursor (DictCursor ).execute (f"show tables like '{ table_name } '" )
435- ).fetchall ()
436- assert table_info [0 ]["kind" ] == "TEMPORARY"
437- finally :
438- await cnx .execute_string (drop_sql )
439-
440-
441420@pytest .mark .parametrize ("use_logical_type" , [None , True , False ])
442421async def test_write_pandas_use_logical_type (
443422 conn_cnx : Callable [..., Generator [SnowflakeConnection ]],
@@ -1228,7 +1207,7 @@ async def test_write_pandas_with_use_vectorized_scanner(
12281207
12291208 drop_sql = f"DROP TABLE IF EXISTS { table_name } "
12301209 async with conn_cnx () as cnx : # type: SnowflakeConnection
1231- original_cur = ( await cnx .cursor () ).execute
1210+ original_cur = cnx .cursor ().execute
12321211
12331212 async def fake_execute (query , params = None , * args , ** kwargs ):
12341213 return await original_cur (query , params , * args , ** kwargs )
0 commit comments