[Django] #32501: Add support for INSERT...RETURNING on SQLite 3.35+

23 views
Skip to first unread message

Django

unread,
Mar 3, 2021, 7:56:24 AM3/3/21
to django-...@googlegroups.com
#32501: Add support for INSERT...RETURNING on SQLite 3.35+
-------------------------------------+-------------------------------------
Reporter: Mariusz | Owner: nobody
Felisiak |
Type: New | Status: new
feature |
Component: Database | Version: master
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Someday/Maybe |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Support for the `RETURNING` clause on `INSERT` statements is one of the
headline features in SQLite 3.35.0 (pending), see
[https://www.sqlite.org/draft/releaselog/3_35_0.html changelog] and
[https://www.sqlite.org/draft/lang_returning.html docs]. This will allow
`bulk_create()` to retrieve primary keys on SQLite.

Follow up to #31403.

--
Ticket URL: <https://code.djangoproject.com/ticket/32501>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 2, 2021, 6:10:40 PM4/2/21
to django-...@googlegroups.com
#32501: Add support for INSERT...RETURNING on SQLite 3.35+
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ian Foote):

* easy: 0 => 1


Comment:

This should be an easy ORM starter ticket.

What will be required is adding an implementation of the
{{{return_insert_columns}}} method to
{{{django/db/backends/sqlite3/operations.py}}} and an implementation of
{{{can_return_columns_from_insert}}} and
{{{can_return_rows_from_bulk_insert}}} to
{{{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.

--
Ticket URL: <https://code.djangoproject.com/ticket/32501#comment:1>

Django

unread,
Apr 6, 2021, 11:41:19 AM4/6/21
to django-...@googlegroups.com
#32501: Add support for INSERT...RETURNING on SQLite 3.35+
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* stage: Someday/Maybe => Accepted


Comment:

https://sqlite.org/releaselog/3_35_0.html

--
Ticket URL: <https://code.djangoproject.com/ticket/32501#comment:2>

Django

unread,
Apr 6, 2021, 12:27:10 PM4/6/21
to django-...@googlegroups.com
#32501: Add support for INSERT...RETURNING on SQLite 3.35+
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Girish
| Sontakke
Type: New feature | Status: assigned

Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Girish Sontakke):

* owner: nobody => Girish Sontakke
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/32501#comment:3>

Django

unread,
Apr 7, 2021, 1:50:26 AM4/7/21
to django-...@googlegroups.com
#32501: Add support for INSERT...RETURNING on SQLite 3.35+
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Girish
| Sontakke
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1
* has_patch: 0 => 1
* needs_docs: 0 => 1


Comment:

[https://github.com/django/django/pull/14227 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/32501#comment:4>

Django

unread,
Apr 7, 2021, 2:11:15 PM4/7/21
to django-...@googlegroups.com
#32501: Add support for INSERT...RETURNING on SQLite 3.35+
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Girish
| Sontakke
Type: New feature | Status: closed

Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"98abc0c90e0eb7fe3a71cfa360962cf59605f1d3" 98abc0c9]:
{{{
#!CommitTicketReference repository=""
revision="98abc0c90e0eb7fe3a71cfa360962cf59605f1d3"
Fixed #32501 -- Added support for returning fields from INSERT statements
on SQLite 3.35+.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/32501#comment:5>

Reply all
Reply to author
Forward
0 new messages