In sqlite, you only get autoincrement behavior when only one integer column is the primary key. composite keys prevent autoincrement from taking effect.
You can get a similar result by defining id
as the only primary key, but then adding an additional unique constraint on id, col3
.
If that’s still not quite what you want (say, id’s don’t need to be unique at all), you probably will have to use a trigger to make autoincrement work.
Related Contents:
- sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 74 supplied
- Importing a CSV file into a sqlite3 database table using Python
- SQLite parameter substitution problem
- Variable table name in sqlite
- Sqlite / SQLAlchemy: how to enforce Foreign Keys?
- Force Python to forego native sqlite3 and use the (installed) latest sqlite3 version
- Django: Deploying an application on Heroku with sqlite3 as the database
- No module named _sqlite3
- How do you escape strings for SQLite table/column names in Python?
- How to retrieve inserted id after inserting row in SQLite using Python?
- python 3.2 UnicodeEncodeError: ‘charmap’ codec can’t encode character ‘\u2013’ in position 9629: character maps to
- List of tables, db schema, dump etc using the Python sqlite3 API
- How to load existing db file to memory in Python sqlite3?
- Sqlite insert query not working with python?
- OperationalError: database is locked
- Python SQLite parameter substitution with wildcards in LIKE
- Inserting a table name into a query gives sqlite3.OperationalError: near “?”: syntax error
- How can I get dict from sqlite query?
- Is there a way to get a list of column names in sqlite?
- Sqlite3, OperationalError: unable to open database file
- How to get a single result from a SQL query in python?
- Using a WHERE ___ IN ___ statement
- Parameter substitution for a SQLite “IN” clause
- Python insert numpy array into sqlite3 database
- How to read datetime back from sqlite as a datetime instead of string in Python?
- Python CSV to SQLite
- Python sqlite3 and concurrency
- Parameter unsupported when inserting int
- Python sqlite3 string variable in execute
- What if I don’t close the database connection in Python SQLite
- Executing an SQL query over a pandas dataset
- “no such table” exception
- Why is SQLAlchemy insert with sqlite 25 times slower than using sqlite3 directly?
- Is this Python code vulnerable to SQL injection? (SQLite3)
- SQLite parameter substitution and quotes
- SQLite not saving data between uses
- How to create a dynamic filter?
- Passing a column name in a SELECT statement in Python
- HDF5 – concurrency, compression & I/O performance [closed]
- Python SQLite: database is locked
- sqlite3.OperationalError: unable to open database file
- Bulk insert huge data into SQLite using Python
- How can the Euclidean distance be calculated with NumPy?
- Parameterized queries with psycopg2 / Python DB-API and PostgreSQL
- Multiple variables in a ‘with’ statement?
- How do threads work in Python, and what are common Python-threading specific pitfalls?
- test for membership in a 2d numpy array
- How to draw a rectangle over a specific region in a matplotlib graph
- Adding headers to requests module
- Can numpy bincount work with 2D arrays?