[Tutor] how to do this using psycopg2

Eggo why eggo at hotmail.com
Fri Oct 18 14:38:19 EDT 2019


Hi all,
     I have following python code  but when perform execute got error due to signal quote.  How can I prepare the query without the signal quote?


sql = ("alter table %s rename to %s")
print(cur.mogrify(sql, (str_tab, tab_b)))
cur.execute(sql, (str_tab, tab_b))


b"alter table 't_win_sys_data_consolidated' rename to 't_win_sys_data_consolidated_B'"
can't adapt type 'SyntaxError'
syntax error at or near "'t_all_remedy_asset_data'"
LINE 1: alter table 't_all_remedy_asset_data' rename to 't_all_remed...


More information about the Tutor mailing list