cur.execute("INSERT INTO kraken_database VALUES (5555775, 777777)") 
  • cur.execute("INSERT INTO kraken_database VALUES (?, ?)", (5555775, 777777)) ? - gil9red
  • it depends what kind of connector you have - Igor Igoryanych
  • connector pcycopg2 - Alex Flow

1 answer 1

Substitution with the pcycopg2 connector:

 values = ({'id': 1, 'name':'Vasya', 'age': 45}) cursor.execute("INSERT INTO tableName(id, name, age) VALUES (%(id)s,%(name)s,%(age)s)", values) 
  • thank you so much, I couldn’t find it at all - Alex Flow
  • @Alex Flow no problem) - Igor Igoryanych