Opened 16 years ago

Closed 16 years ago

#4896 closed (fixed)

Buggy implementation of executemany for oracle

Reported by: jdetaeye@… Owned by: Ian 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


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\", line 30, in executemany
    return self.cursor.executemany(sql, param_list)
  File "C:\packages\Python-2.5\lib\site-packages\django\db\backends\oracle\", line 125, in executemany
    query, params = self._rewrite_args(query, params)
  File "C:\packages\Python-2.5\lib\site-packages\django\db\backends\oracle\", line 101, in _rewrite_args
    query = smart_str(query, self.charset) % tuple(args)
  TypeError: not all arguments converted during string formatting

Attachments (1)

executemany_oracle_sqlite.patch (3.8 KB) - added by jdetaeye@… 16 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 16 years ago by Malcolm Tredinnick

Owner: changed from Adrian Holovaty to Malcolm Tredinnick
Triage Stage: UnreviewedAccepted

Whoops. My bad. I'll fix it when I get a moment.

Changed 16 years ago by jdetaeye@…


comment:2 Changed 16 years ago by jdetaeye@…

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 Changed 16 years ago by Ian Kelly

Owner: changed from nobody to Ian Kelly
Status: newassigned

comment:4 Changed 16 years ago by Ian Kelly

Resolution: fixed
Status: assignedclosed

(In [6218]) Fixed #4896: fixed #4765: Patch for cursor.executemany using oracle and
sqlite3. Thanks, jdetaeye@…

Note: See TracTickets for help on using tickets.
Back to Top