@@ -87,14 +87,12 @@ def _do_create_temp_stage(
8787 overwrite : bool ,
8888 use_scoped_temp_object : bool ,
8989) -> None :
90- create_stage_sql = f"CREATE { get_temp_type_for_object (use_scoped_temp_object )} STAGE /* Python:snowflake.connector.pandas_tools.write_pandas() */ identifier(?) FILE_FORMAT=(TYPE=PARQUET COMPRESSION={ compression } { ' BINARY_AS_TEXT=FALSE' if auto_create_table or overwrite else '' } )"
91- params = (stage_location ,)
92- logger .debug (f"creating stage with '{ create_stage_sql } '. params: %s" , params )
90+ create_stage_sql = f"CREATE { get_temp_type_for_object (use_scoped_temp_object )} STAGE /* Python:snowflake.connector.pandas_tools.write_pandas() */ identifier('{ stage_location } ') FILE_FORMAT=(TYPE=PARQUET COMPRESSION={ compression } { ' BINARY_AS_TEXT=FALSE' if auto_create_table or overwrite else '' } )"
91+ logger .debug (f"creating stage with '{ create_stage_sql } '." )
9392 cursor .execute (
9493 create_stage_sql ,
9594 _is_internal = True ,
9695 _force_qmark_paramstyle = True ,
97- params = params ,
9896 num_statements = 1 ,
9997 )
10098
@@ -156,17 +154,15 @@ def _do_create_temp_file_format(
156154 use_scoped_temp_object : bool ,
157155) -> None :
158156 file_format_sql = (
159- f"CREATE { get_temp_type_for_object (use_scoped_temp_object )} FILE FORMAT identifier(? ) "
157+ f"CREATE { get_temp_type_for_object (use_scoped_temp_object )} FILE FORMAT identifier(' { file_format_location } ' ) "
160158 f"/* Python:snowflake.connector.pandas_tools.write_pandas() */ "
161159 f"TYPE=PARQUET COMPRESSION={ compression } { sql_use_logical_type } "
162160 )
163- params = (file_format_location ,)
164- logger .debug (f"creating file format with '{ file_format_sql } '. params: %s" , params )
161+ logger .debug (f"creating file format with '{ file_format_sql } '." )
165162 cursor .execute (
166163 file_format_sql ,
167164 _is_internal = True ,
168165 _force_qmark_paramstyle = True ,
169- params = params ,
170166 num_statements = 1 ,
171167 )
172168
@@ -475,14 +471,12 @@ def write_pandas(
475471 columns = quote + f"{ quote } ,{ quote } " .join (snowflake_column_names ) + quote
476472
477473 def drop_object (name : str , object_type : str ) -> None :
478- drop_sql = f"DROP { object_type .upper ()} IF EXISTS identifier(?) /* Python:snowflake.connector.pandas_tools.write_pandas() */"
479- params = (name ,)
480- logger .debug (f"dropping { object_type } with '{ drop_sql } '. params: %s" , params )
474+ drop_sql = f"DROP { object_type .upper ()} IF EXISTS identifier('{ name } ') /* Python:snowflake.connector.pandas_tools.write_pandas() */"
475+ logger .debug (f"dropping { object_type } with '{ drop_sql } '." )
481476 cursor .execute (
482477 drop_sql ,
483478 _is_internal = True ,
484479 _force_qmark_paramstyle = True ,
485- params = params ,
486480 num_statements = 1 ,
487481 )
488482
@@ -531,19 +525,15 @@ def drop_object(name: str, object_type: str) -> None:
531525 )
532526
533527 create_table_sql = (
534- f"CREATE { table_type .upper ()} { iceberg } TABLE IF NOT EXISTS identifier(? ) "
528+ f"CREATE { table_type .upper ()} { iceberg } TABLE IF NOT EXISTS identifier(' { target_table_location } ' ) "
535529 f"({ create_table_columns } ) { iceberg_config_statement } "
536530 f" /* Python:snowflake.connector.pandas_tools.write_pandas() */ "
537531 )
538- params = (target_table_location ,)
539- logger .debug (
540- f"auto creating table with '{ create_table_sql } '. params: %s" , params
541- )
532+ logger .debug (f"auto creating table with '{ create_table_sql } '." )
542533 cursor .execute (
543534 create_table_sql ,
544535 _is_internal = True ,
545536 _force_qmark_paramstyle = True ,
546- params = params ,
547537 num_statements = 1 ,
548538 )
549539 # need explicit casting when the underlying table schema is inferred
@@ -564,14 +554,12 @@ def drop_object(name: str, object_type: str) -> None:
564554
565555 try :
566556 if overwrite and (not auto_create_table ):
567- truncate_sql = "TRUNCATE TABLE identifier(?) /* Python:snowflake.connector.pandas_tools.write_pandas() */"
568- params = (target_table_location ,)
569- logger .debug (f"truncating table with '{ truncate_sql } '. params: %s" , params )
557+ truncate_sql = f"TRUNCATE TABLE identifier('{ target_table_location } ') /* Python:snowflake.connector.pandas_tools.write_pandas() */"
558+ logger .debug (f"truncating table with '{ truncate_sql } '" )
570559 cursor .execute (
571560 truncate_sql ,
572561 _is_internal = True ,
573562 _force_qmark_paramstyle = True ,
574- params = params ,
575563 num_statements = 1 ,
576564 )
577565
@@ -605,14 +593,12 @@ def drop_object(name: str, object_type: str) -> None:
605593 quote_identifiers = quote_identifiers ,
606594 )
607595 drop_object (original_table_location , "table" )
608- rename_table_sql = "ALTER TABLE identifier(?) RENAME TO identifier(?) /* Python:snowflake.connector.pandas_tools.write_pandas() */"
609- params = (target_table_location , original_table_location )
610- logger .debug (f"rename table with '{ rename_table_sql } '. params: %s" , params )
596+ rename_table_sql = f"ALTER TABLE identifier('{ target_table_location } ') RENAME TO identifier('{ original_table_location } ') /* Python:snowflake.connector.pandas_tools.write_pandas() */"
597+ logger .debug (f"rename table with '{ rename_table_sql } '." )
611598 cursor .execute (
612599 rename_table_sql ,
613600 _is_internal = True ,
614601 _force_qmark_paramstyle = True ,
615- params = params ,
616602 num_statements = 1 ,
617603 )
618604 except ProgrammingError :
0 commit comments