#2561: ValueError: string data too large when using cx_Oracle and executemany
-------------------------------------------+-------------------------------
Reporter: Bluehorn | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.7.10
Component: oracle | Severity: minor - half an
Resolution: | hour
Progress State: needs questions answered | Keywords:
-------------------------------------------+-------------------------------
Comment (by Bluehorn):
Replying to [comment:2 zzzeek]:
> first off, congrats on getting Anthony to respond to you. I'm not able
to get a response from him on a different issue (#2469).
Eh, where did I say he did respond to me? The linked gmane thread was not
started by me and is from 2010.
> in this case the gmane thread seems to suggest that setinputsizes()
should be clearing up the issue. We call setinputsizes for all types
*except* STRING, UNICODE, NCLOB, CLOB. this has been like this for a long
time as there were various issues observed, however I wonder if by now we
can just either remove that altogether or at least remove NCLOB, CLOB from
the excluded list. Can you try this against 0.7 please:
>
> {{{
> #!diff
> diff -r c1d46317f04b lib/sqlalchemy/dialects/oracle/cx_oracle.py
> --- a/lib/sqlalchemy/dialects/oracle/cx_oracle.py Fri Aug 31
20:03:57 2012 -0400
> +++ b/lib/sqlalchemy/dialects/oracle/cx_oracle.py Wed Sep 05
17:18:11 2012 -0400
> @@ -337,7 +337,7 @@
> # on String, including that outparams/RETURNING
> # breaks for varchars
> self.set_input_sizes(quoted_bind_names,
> -
exclude_types=self.dialect._cx_oracle_string_types
> +
exclude_types=self.dialect._cx_oracle_exclude_setinputsizes
> )
>
> # if a single execute, check for outparams
> @@ -507,6 +507,7 @@
> getattr(self.dbapi, name, None) for name in
names
> ]).difference([None])
>
> + self._cx_oracle_exclude_setinputsizes = types("STRING",
"UNICODE")
> self._cx_oracle_string_types = types("STRING", "UNICODE",
"NCLOB", "CLOB")
> self._cx_oracle_unicode_types = types("UNICODE", "NCLOB")
> self._cx_oracle_binary_types = types("BFILE", "CLOB", "NCLOB",
"BLOB")
> }}}
I would have tried earlier but I can only run this on the continuous
integration system and I did not want to break our deployment for the sake
of testing that patch.
With the patch applied, the above sample scripts both pass (and they fail
without the patch). Thank you!
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2561#comment:5>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|