Python Forum
sqlite3 operational error on insert query
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
sqlite3 operational error on insert query
#5
Interesting as when I try it on a smaller table with only a few fields it works and that was all on one line.

However, I initially had it on one line and it comes back with 'Programming Error'. When I hover over the line (when it's as one line), it says: PEP 8:line too long (570 > 120 characters).

This is really annoying as if it would just let me run the query without all of this (?,?,?) malarkey, I would be OK....probably ;)

Cheers,
Me

Right, got there via another source. Turns out I need to use all single quotes and it's fine:

cur.execute(
                'insert into lr_rundata (current_date, test_name, app_version, test_run_period, transaction_name, ' \
                'sla_status, minimum, average, maximum, std_deviation, percentile80, percentile81, percentile82, percentile83, percentile84, ' \
                'percentile85, percentile86, percentile87, percentile88, percentile89, percentile90, percentile91, percentile92, percentile93,' \
                'percentile94, percentile95, percentile96, percentile97, percentile98, percentile99, pass, fail, stop, deleted) values ' \
                '(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', sql_formatted)
Reply


Messages In This Thread
RE: sqlite3 operational error on insert query - by jonesin1974 - Jun-26-2018, 03:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  sqlite3 Conn Insert Value Error TylerDunbar 3 808 Sep-04-2023, 06:32 PM
Last Post: deanhystad
  Basic SQL query using Py: Inserting or querying sqlite3 database not returning data marlonbown 3 1,454 Nov-08-2022, 07:16 PM
Last Post: marlonbown
  Mysql error message: Lost connection to MySQL server during query tomtom 6 16,418 Feb-09-2022, 09:55 AM
Last Post: ibreeden
  pymysql: insert query throws error wardancer84 12 4,757 Jan-28-2022, 06:48 AM
Last Post: wardancer84
  Query Syntax Error hammer 2 1,665 Jan-03-2022, 02:30 PM
Last Post: hammer
  TypeError: sequence item 0: expected str instance, float found Error Query eddywinch82 1 5,218 Sep-04-2021, 09:16 PM
Last Post: eddywinch82
  Error using mariadb select query with form in python? shams 2 2,065 Jul-29-2021, 12:30 PM
Last Post: shams
  sqlite3.OperationalError: near "=": syntax error Maryan 1 5,702 Oct-31-2020, 12:09 AM
Last Post: Maryan
  sqlite3.OperationalError: near "%": syntax error Linuxdesire 2 18,154 Oct-13-2019, 02:54 AM
Last Post: Linuxdesire
  psycopg2 insert error Wonder_women 0 2,700 Jun-10-2019, 11:56 AM
Last Post: Wonder_women

Forum Jump:

User Panel Messages

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