--- /dev/null
+.. change::
+ :tags: bug, oracle
+ :tickets: 4163
+
+ The cx_Oracle dialect now calls setinputsizes() with cx_Oracle.NCHAR
+ unconditionally when the NVARCHAR2 datatype, in SQLAlchemy corresponding
+ to sqltypes.Unicode(), is in use. Per cx_Oracle's author this allows
+ the correct conversions to occur within the Oracle client regardless
+ of the setting for NLS_NCHAR_CHARACTERSET.
-# oracle/cx_oracle.py
# Copyright (C) 2005-2018 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
class _OracleNVarChar(sqltypes.NVARCHAR):
def get_dbapi_type(self, dbapi):
- return getattr(dbapi, 'UNICODE', dbapi.STRING)
+ return dbapi.NCHAR
class _OracleText(sqltypes.Text):
self._include_setinputsizes = {
cx_Oracle.NCLOB, cx_Oracle.CLOB, cx_Oracle.LOB,
+ cx_Oracle.NCHAR, cx_Oracle.FIXED_NCHAR,
cx_Oracle.BLOB, cx_Oracle.FIXED_CHAR, cx_Oracle.TIMESTAMP
}