Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9271541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:38:41+00:00 2026-06-18T15:38:41+00:00

I created a table in sqlite3, following is the structure: cid name type notnull

  • 0

I created a table in sqlite3, following is the structure:

cid     name                    type    notnull         pk
0   wheelId                 INTEGER 1       1
1   wheelName           VARCHAR 1       0
2   paraDiam            INTEGER 0       0
3   paraWidth           FLOAT   0       0
4   paraEt                  FLOAT   0       0
5   paraHole            INTEGER 0       0
6   factParaHole            INTEGER 0       0
7   paraCenterhole          FLOAT   0       0
8   wheelColorName          VARCHAR 0       0
9   wheelColorNameShow  TEXT    0       0
10  paraWeight          FLOAT   0       0
11  vpPrice                 INTEGER 0       0
12  ntStock                 INTEGER 0       0
13  wheelURL            VARCHAR 0       0
14  wheelImg            VARCHAR 0       0
15  wheelRank           INTEGER 0       0

and now, I use python to insert a record into the table, and I only want to insert the column value ‘wheelName’, ‘wheelImg’ and keep the other columns null, (the first one is wheelId, and I hope it can increment by itself automatically).

I used almost every method I can find on the website:

  1. cursor.execute("""INSERT INTO WHEELS (wheelName,wheelImg) VALUES (%s,%s)""" ,
    (WHEELNAME,WHEELIMG))

    Python throws sqlite3.OperationalError: near "%": syntax error

  2.  

    cursor.execute("""INSERT INTO WHEELS(WHEELID,WHEELNAME, PARADIAM, PARAWIDTH, PARAET,PARAHOLE,FACTPARAHOLE,
                            PARACENTERHOLE,WHEELCOLORNAME,WHEELCOLORNAMESHOW,PARAWEIGHT,VPPRICE,NTSTOCK,
                            WHEELURL,WHEELIMG,WHEELRANK)
    
                   VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)""" ,
                   (WHEELID, WHEELNAME, PARADIAM, PARAWIDTH, PARAET,PARAHOLE,FACTPARAHOLE,
                    PARACENTERHOLE,WHEELCOLORNAME,WHEELCOLORNAMESHOW,PARAWEIGHT,VPPRICE,NTSTOCK,
                    WHEELURL,WHEELIMG,WHEELRANK))
    

where I set the other values to None
like:

PARADIAM = None
PARAWIDTH = None
PARAET = None
PARAHOLE = None

and python again throws sqlite3.OperationalError: near "%": syntax error.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T15:38:42+00:00Added an answer on June 18, 2026 at 3:38 pm

    The sqlite3 adapter uses ? for SQL parameters, not %s:

    cursor.execute("INSERT INTO WHEELS (wheelName,wheelImg) VALUES (?, ?)", (WHEELNAME,WHEELIMG))
    

    Your schema also restricts the wheelColorNameShow:

    "wheelColorNameShow" TEXT check(typeof("wheelColorNameShow") = 'text')
    

    which means it can no longer be NULL. You have to include a value for that column too:

    cursor.execute('insert into wheels (wheelName,wheelImg,wheelColorNameShow) VALUES (?, ?, ?)', ('test', 'test', 'test'))
    

    succeeds.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a table by following query: with sqlite3.connect('example.db', detect_types=sqlite3.PARSE_DECLTYPES) as conn: cur =
I have a table with the following column structure: sqlite> create table stocks(stockticker varchar(4),
I have the following table in a SQLite3 database: CREATE TABLE overlap_results ( neighbors_of_annotation
following is the bash script I wrote for Sqlite. #!/bin/bash sqlite3 file.db CREATE TABLE
how to create a table with sha1 or md5 as table name in sqlite3
Hello Stackoverflowers! I created a simple sqlite DB like so. //event table name private
I created a table named dept in sqlite manually that has username (as Varchar)
I have already created a table to the database. Table is something like following
I have created the following tables in SQLite3 to tag items (after reading this
I wrote a piece of sqlite3 query as following: CREATE TABLE appearances( char_id int,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.