#22669: bulk_create with empty model fields fails on oracle
-------------------------------------+-------------------------------------
Reporter: sns1081@… | Owner: mnach
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
QuerySet.bulk_create |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by mnach):
My investigation of this subject came to this approach:
{{{
cursor.setinputsizes(arg0 = cx_Oracle.NUMBER)
cursor.execute("select 1 from dual union all select :arg0 from dual", arg0
= None)
}}}
by Anthony Tuininga at [https://sourceforge.net/p/cx-
oracle/mailman/message/35021744/ cx_Oracle mailing list]
method setinputsizes is a part of
[https://www.python.org/dev/peps/pep-0249/#id18 Python Database API
Specification v2.0] and [https://www.python.org/dev/peps/pep-0248/ Python
Database API Specification v1.0]. Backends which support it:
* cx_Oracle > 2.4 ([http://cx-
oracle.readthedocs.org/en/latest/releasenotes.html#version-2-4 release
notes])
* pysycopg > 1.99.12
([https://github.com/psycopg/psycopg2/blob/1_99_12/psycopg/cursor_type.c#L821-L839
github tag 1_99_12])
* mysqlclient > 0.9.2 ([https://github.com/PyMySQL/mysqlclient-
python/blame/e76b691d9ea69146ac7f8127a6bdccae53b70973/MySQLdb/cursors.py#L166
github "blame" on this method])
* sqlite - don't actually know, but sqlite3 in cpython 2.6.8 supports this
method
So, I guess that SQLCompiller classes can contain method like
"prepare_cursor" which gets arguments from, for example, a database
wrapper and pass them to setinputsizes method (and maybe to setoutputsize
if it will be needed)
I need to ask @devs: Is this approach better than using "cast(:var as
number)" inside query ?
--
Ticket URL: <https://code.djangoproject.com/ticket/22669#comment:8>
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/075.d4c872367ab4c48859b465eb641a4cc5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.