On Sep 13, 2010, at 8:26 AM, Kevin Mills wrote:

> I just want to make sure that what I am reading at 
> http://www.sqlalchemy.org/docs/dialects/oracle.html#connecting is correct 
> when connecting to an Oracle database using sqa.  When I was using cx_Oracle 
> directly I would have to use cursor.setinputseizes when I am using bind 
> variables (especially when I have a rather large CLOB data structure).  It 
> seems that sqa does this automatically when I connect to the database.  Am I 
> reading it correctly or is there another step that I need to complete?

yes, we're calling it, since many datatypes simply don't work with cx_oracle if 
you don't.

Though if you're having issues with CLOB, that would make sense as we are 
currently excluding STRING, UNICODE, NCLOB, CLOB from the list of types.   
Examining why this is the case, it seems like STRING has issues when you use it 
with RETURNING, and perhaps an assumption was made at some point to lump NCLOB 
and CLOB in there but its likely that this is inappropriate (we have tests with 
CLOB which succeed - but....I'm going to guess that none of them have an input 
string more than 4k).

If this is the case please let me know we'll add some CLOB tests.   Here's a 
patch to get you going if this is indeed the case:

diff -r 2cc844408821 lib/sqlalchemy/dialects/oracle/cx_oracle.py
--- a/lib/sqlalchemy/dialects/oracle/cx_oracle.py       Mon Sep 13 02:39:39 
2010 -0400
+++ b/lib/sqlalchemy/dialects/oracle/cx_oracle.py       Mon Sep 13 10:53:10 
2010 -0400
@@ -257,7 +257,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._exclude_setinputsizes
                                 )
 
         # if a single execute, check for outparams
@@ -426,8 +426,7 @@
                         getattr(self.dbapi, name, None) for name in names
                     ]).difference([None])
 
-        self._cx_oracle_string_types = types("STRING", "UNICODE", "NCLOB", 
"CLOB")
-        self._cx_oracle_unicode_types = types("UNICODE", "NCLOB")
+        self._exclude_setinputsizes = types("STRING", "UNICODE")
         self._cx_oracle_binary_types = types("BFILE", "CLOB", "NCLOB", "BLOB") 
         self.supports_unicode_binds = self.cx_oracle_ver >= (5, 0)
         self.supports_native_decimal = self.cx_oracle_ver >= (5, 0)
@@ -435,7 +434,7 @@
 
         if self.cx_oracle_ver is None:
             # this occurs in tests with mock DBAPIs
-            self._cx_oracle_string_types = set()
+            self._exclude_setinputsizes = set()
             self._cx_oracle_with_unicode = False
         elif self.cx_oracle_ver >= (5,) and not hasattr(self.dbapi, 'UNICODE'):
             # cx_Oracle WITH_UNICODE mode.  *only* python




-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to