Using %s commands in execute statements (python) in mySQL vs postgreSQL? -
I am currently writing code in Python which works with PostGrace SQL Database, and it looks like the following "" IN.ER (command, id, date, timestamp) in values (id, date, timest): "", (Si (table): <% S (% s,% s,% s) , ID, ASI (date), ASI (timestamp))
This post works fine for GRESQL, but when I do the same thing mySQL server, it does not work that Minister to have an idea why? I think it may have to be done with% s characters, because it works if I hardcode values in the table, id, date, and timestamp.
In addition, it gives me the following error:
_mysql_exceptions.ProgrammingError: (1064, "There is an error in your SQL syntax; 'Master' is the name of the table used as a variable, and I also saw that the master had two single quotes (such as: "Master"), where only one should be, is it a Can also be a problem?
Anyway, thanks for the help!
This does not work well in PostgreSQL The table name should either not be parametric.
cur.execute ("" "table_name_ here (id, date, timest) INSERT ... ... < String combination for / pre> : Postgrades uses the SQL-standard double quote ( not two single quotes!): "master" , which is the default MySQL does not work.> `Master` - or just to work in both Master . or a setting for some SQL-compliant in MySQL Sic Riy to:
SET sql_mode = 'ANSI';
Comments
Post a Comment