Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Deleting data in sqlite3
#4
Hi,

Quote:How can I replace the formatting?
Hardcode the table name into the SQL statement.

What I've overseen initially is another mistake: you can _not_ have the column name as a variable as well. The replacement acc. to the Python DB API 2.0 is only for values. like c.execute('DELETE FROM foo wHERE bar = ?', ('spamegg', ))

In case you feel you need this "flexibility" on queries, your database / table design is most likely "not too good" aka need improvement.

Regards, noisefloor
Reply


Messages In This Thread
Deleting data in sqlite3 - by JJ39 - Jun-23-2019, 02:59 PM
RE: Deleting data in sqlite3 - by noisefloor - Jun-23-2019, 03:11 PM
RE: Deleting data in sqlite3 - by JJ39 - Jun-23-2019, 03:25 PM
RE: Deleting data in sqlite3 - by noisefloor - Jun-23-2019, 04:39 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Basic SQL query using Py: Inserting or querying sqlite3 database not returning data marlonbown 3 1,394 Nov-08-2022, 07:16 PM
Last Post: marlonbown
  Data is deleting korotkovap 1 1,719 Aug-16-2020, 06:57 AM
Last Post: buran
  Adding data to a table in SQLite3 djwilson0495 2 3,086 Aug-15-2020, 02:48 PM
Last Post: djwilson0495
  Find data using a period of time in SQLITE3 SmukasPlays 2 2,196 Jul-30-2020, 02:02 PM
Last Post: SmukasPlays
  Deleting data in SQlite3 SmukasPlays 0 1,465 Jul-25-2020, 02:07 PM
Last Post: SmukasPlays
  sqlite3 database does not save data across restarting the program SheeppOSU 1 3,459 Jul-24-2020, 05:53 AM
Last Post: SheeppOSU
  Deleting a row in SQlite3 SmukasPlays 3 2,062 Jul-23-2020, 05:30 AM
Last Post: ndc85430
  How can I add some data from file.txt to db.sqlite3 ? Mike Ru 1 3,079 Nov-19-2018, 05:35 AM
Last Post: Mike Ru

Forum Jump:

User Panel Messages

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