Opened 17 years ago
Closed 17 years ago
#4896 closed (fixed)
Buggy implementation of executemany for oracle
Reported by: | Owned by: | Erin Kelly | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Keywords: | oracle executemany | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The following example shows the buggy implementation. The same example works fine with sqlite and postgresql.
cursor = connection.cursor() cursor.execute('create table test (Field1 NUMBER(11),Field2 NUMBER(11))') cursor.executemany('insert into test values (%s, %s)', [(i,i+1) for i in range(1,100)])
It returns the following error message:
File "C:\packages\Python-2.5\lib\site-packages\django\db\backends\util.py", line 30, in executemany return self.cursor.executemany(sql, param_list) File "C:\packages\Python-2.5\lib\site-packages\django\db\backends\oracle\base.py", line 125, in executemany query, params = self._rewrite_args(query, params) File "C:\packages\Python-2.5\lib\site-packages\django\db\backends\oracle\base.py", line 101, in _rewrite_args query = smart_str(query, self.charset) % tuple(args) TypeError: not all arguments converted during string formatting
Attachments (1)
Change History (5)
comment:1 by , 17 years ago
Owner: | changed from | to
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 17 years ago
Has patch: | set |
---|
Takes a while to find a moment... :-)
Here is a patch that fixes this issue, as well as ticket #4765 that reports a problem with executemany on sqlite.
comment:3 by , 17 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:4 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
Whoops. My bad. I'll fix it when I get a moment.