Opened 4 years ago
Closed 4 years ago
#32501 closed New feature (fixed)
Add support for INSERT...RETURNING on SQLite 3.35+
Reported by: | Mariusz Felisiak | Owned by: | Girish Sontakke |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | yes | UI/UX: | no |
Description
Support for the RETURNING
clause on INSERT
statements is one of the headline features in SQLite 3.35.0 (pending), see changelog and docs. This will allow bulk_create()
to retrieve primary keys on SQLite.
Follow up to #31403.
Change History (5)
comment:2 by , 4 years ago
Triage Stage: | Someday/Maybe → Accepted |
---|
comment:3 by , 4 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Note:
See TracTickets
for help on using tickets.
This should be an easy ORM starter ticket.
What will be required is adding an implementation of the
return_insert_columns
method to https://github.com/django/django/blob/main/django/db/backends/sqlite3/operations.py and an implementation ofcan_return_columns_from_insert
andcan_return_rows_from_bulk_insert
to https://github.com/django/django/blob/main/django/db/backends/sqlite3/features.py. Reference implementations can be found in the corresponding files for other database backends.There are some existing tests in https://github.com/django/django/blob/main/tests/queries/test_db_returning.py.