Python Forum
Inserting a variable as column name in sqlite3 python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inserting a variable as column name in sqlite3 python
#1
So how exactly do you do it? I have tried doing this -
'UPDATE Table SET {} WHERE name=?'.format(col) , [name])
and this -
'UPDATE Table SET %s WHERE name=?' % (col,), [name]
Both have been giving me the error of
Error:
OperationalError: near "WHERE": syntax error
. Is this even possible?
Reply


Messages In This Thread
Inserting a variable as column name in sqlite3 python - by JellyCreeper6 - Oct-22-2020, 03:19 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Inserting data from python list into a pandas dataframe mahmoud899 0 3,017 Mar-02-2019, 04:07 AM
Last Post: mahmoud899
  How to modify and save a column in the sqlite3 database using python? laithsky1 3 3,887 Dec-18-2018, 03:39 AM
Last Post: micseydel
  Bar Plot with Python ,matplotlib and sqlite3 tables gauravbhardwajee 0 5,728 Sep-25-2018, 06:17 PM
Last Post: gauravbhardwajee

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020