Python Forum
Auto increment in Python Sqlite3
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Auto increment in Python Sqlite3
#1
Hi. I want to set my id auto increment in sqlite3 in python 3.6

When i run my code i get this error:

Error:
sqlite3.OperationalError: near "AUTOINCREMENT": syntax error
And my code is:


import sqlite3 as sq

conn = sq.connect("shut.db")

cur = conn.cursor()

cur.execute(''' CREATE TABLE Shut (ID INT PRIMARY KEY NOT NULL AUTOINCREMENT,
                                    NAME TEXT NOT NULL); ''')
What is my problem?
Reply
#2
Read: https://sqlite.org/autoinc.html
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  help to increment a third list hermine 7 1,270 Nov-29-2022, 04:19 PM
Last Post: perfringo
  mysql id auto increment not working tantony 10 2,310 Oct-18-2022, 11:43 PM
Last Post: Pedroski55
  doubt about python tkinter and sqlite3 LONDER 2 2,119 Aug-14-2021, 08:48 AM
Last Post: ibreeden
  Python, PySimpleGUI and SQLite3 jamesaarr 0 1,943 Jul-29-2021, 01:22 PM
Last Post: jamesaarr
  Python Variables and Sqlite3 Database Staples200 1 3,092 May-25-2021, 02:40 AM
Last Post: Staples200
  Character Increment AnokhiRaaz 1 2,461 Apr-22-2021, 04:29 AM
Last Post: buran
  Increment text files output and limit contains Kaminsky 1 3,135 Jan-30-2021, 06:58 PM
Last Post: bowlofred
  Increment formula Kristenl2784 4 2,818 Jul-20-2020, 10:14 PM
Last Post: Kristenl2784
  [openpyxl] Increment cells being pasted into Template Kristenl2784 4 3,507 Jul-16-2020, 10:00 PM
Last Post: Kristenl2784
  auto supply values to a python script(function) from text file metro17 4 2,483 Oct-26-2019, 01:25 AM
Last Post: ichabod801

Forum Jump:

User Panel Messages

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