#21454: Ignoring certain fields on INSERT and UPDATE queries
-------------------------------------+-------------------------------------
Reporter: mpessas | Owner: mpessas
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Comment (by manfre):
Replying to [comment:4 mpessas]:
>
> Check commit
https://github.com/mpessas/django/commit/dac93937c66040cb901e5e48bd6deba5ce51de9e.
If the backend supports the RETURNING clause, we use that to fetch the
values the database has given to the db-default fields. Otherwise, an
extra SELECT query is issued. If the user does not want this overhead, he
can set `force_fetch=False` (which is the default).
>
> There are two main issues here: I have not checked yet how this works,
when Model inheritance is used and the Oracle backend is broken.
>
> Regarding the latter, I have not found any helpful docs about the
RETURNING clause and I cannot test it either. Is there someone I could ask
or should I contact the cx_oracle developers directly?
.
It's possible that a database backend is capable of returning the IDs from
an insert without supporting the {{{RETURNING}}} clause. Those should be
separate features. I previously injected a select statement to return the
inserted ID without needing a second round trip to the MSSQL server. It's
also possible that certain database drivers may return newly inserted IDs
without SQL.
MSSQL supports the {{{OUTPUT}}} clause, which is similar to
{{{RETURNING}}}, but not exactly the same. Once I add Django 1.7 support
to django-mssql, I'll test out your branch. The primary database I develop
django-mssql against is a heavy user of readonly fields (computed fields,
populated with triggers/SSIS, etc). We've made due with a Manager that
lets me define the readonly fields and having to manually refresh the
instance after certain inserts.
--
Ticket URL: <https://code.djangoproject.com/ticket/21454#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.15b14a2b835a2306244e4d8eb7230471%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.