Django

Code

Ticket #4896 (closed: fixed)

Opened 1 year ago

Last modified 1 year ago

Buggy implementation of executemany for oracle

Reported by: jdetaeye@www.frepple.com Assigned to: ikelly
Milestone: Component: Database layer (models, ORM)
Version: SVN Keywords: oracle executemany
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

executemany_oracle_sqlite.patch (3.8 kB) - added by jdetaeye@frepple.com on 09/08/07 03:52:48.
Patch

Change History

07/16/07 21:03:10 changed by mtredinnick

  • owner changed from adrian to mtredinnick.
  • needs_better_patch changed.
  • stage changed from Unreviewed to Accepted.
  • needs_tests changed.
  • needs_docs changed.

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

09/08/07 03:52:48 changed by jdetaeye@frepple.com

  • attachment executemany_oracle_sqlite.patch added.

Patch

09/08/07 03:55:45 changed by jdetaeye@frepple.com

  • has_patch set to 1.

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.

09/14/07 13:31:55 changed by ikelly

  • owner changed from nobody to ikelly.
  • status changed from new to assigned.

09/14/07 16:32:25 changed by ikelly

  • status changed from assigned to closed.
  • resolution set to fixed.

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


Add/Change #4896 (Buggy implementation of executemany for oracle)




Change Properties
Action