diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-05-07 13:56:38 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-05-08 14:22:46 -0400 |
commit | fb28e40b31797dc9ad72f11a8edd4f2eb555a36d (patch) | |
tree | a9d061b2e94a6149d56746e06fa2b7d01f3b4f1b /lib/sqlalchemy/dialects | |
parent | 9821bddfcb3c94cea13b7f19bcb27845b0dc1ed8 (diff) | |
download | sqlalchemy-fb28e40b31797dc9ad72f11a8edd4f2eb555a36d.tar.gz |
Use cx_oracle.LONG_STRING /LONG_BINARY for CLOB/BLOB
Changed the implementation of fetching CLOB and BLOB objects to use
cx_Oracle's native implementation which fetches CLOB/BLOB objects inline
with other result columns, rather than performing a separate fetch. As
always, this can be disabled by setting auto_convert_lobs to False.
As part of this change, the behavior of a CLOB that was given a blank
string on INSERT now returns None on SELECT, which is now consistent with
that of VARCHAR on Oracle.
Fixes: #5314
Change-Id: I7b46c91704b6f5d6c157e083505dac6e0cb3ef6e
Diffstat (limited to 'lib/sqlalchemy/dialects')
-rw-r--r-- | lib/sqlalchemy/dialects/oracle/cx_oracle.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/sqlalchemy/dialects/oracle/cx_oracle.py b/lib/sqlalchemy/dialects/oracle/cx_oracle.py index 4ff0f65ed..c61a1cc0a 100644 --- a/lib/sqlalchemy/dialects/oracle/cx_oracle.py +++ b/lib/sqlalchemy/dialects/oracle/cx_oracle.py @@ -1003,17 +1003,16 @@ class OracleDialect_cx_oracle(OracleDialect): dialect.encoding, errors=dialect.encoding_errors ) return cursor.var( - default_type, + cx_Oracle.LONG_STRING, size, cursor.arraysize, - outconverter=lambda value: outconverter(value.read()), + outconverter=outconverter, ) else: return cursor.var( - default_type, + cx_Oracle.LONG_STRING, size, cursor.arraysize, - outconverter=lambda value: value.read(), **dialect._cursor_var_unicode_kwargs ) @@ -1021,10 +1020,7 @@ class OracleDialect_cx_oracle(OracleDialect): cx_Oracle.BLOB, ): return cursor.var( - default_type, - size, - cursor.arraysize, - outconverter=lambda value: value.read(), + cx_Oracle.LONG_BINARY, size, cursor.arraysize, ) return output_type_handler |