Closed recognosco closed 1 year ago
I don't believe this is a bug. The type STRING
is limited in Oracle to either 4000 bytes or 32767 bytes (depending on the configuration of your database). In addition, the Oracle client libraries specify that you must provide a length and this amount of memory will be allocated. The type LONG_STRING
is handled a bit differently as the length is not known up front and memory is allocated dynamically as required. cx_Oracle does this transition automatically if the size detected exceeds 32767 -- so you would need to specify a size greater than that amount or explicitly pick the type LONG_STRING
.
The new driver (python-oracledb) has a thin mode which is not restricted in this fashion. It does not require the size and everything is done dynamically. As a bonus it also outperforms thick mode (and cx_Oracle) under most cicrumstances (but it doesn't implement everything that thick mode does yet). SQLAlchemy is known to work with python-oracledb and version 2.0 (in beta right now) supports it explicitly. You can use this technique with version 1.4.
@recognosco see the release announcement for information about cx_Oracle and python-oracledb.
@recognosco can you report the coerce_to_unicode
type behavior change to the SQLAlchemy repo?
Also you might be interested in https://medium.com/gitconnected/using-python-oracledb-1-0-with-sqlalchemy-pandas-django-and-flask-5d84e910cb19
Which coerce_to_unicode
change are you referring to anyway? Mike Bayer worked with me on the more recent changes and they should be fine as far as I know! More details would definitely be helpful if you want additional guidance.
This issue has been automatically marked as inactive because it has not been updated recently. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed because it has not been updated for a month.
I second this.
Happens when I call sqlalchemy
's inspector.get_view_definition()
(only for some views), and disappears when I set coerce_to_unicode=False
.
Can't provide any detailed info, though.
Windows, cx_Oracle v.8.3.0.
@DartVeDroid it's time to upgrade from 8.3 to the latest version, which was renamed to python-oracledb. See the release announcement. Also see:
Is it an error or a hang or a crash? It's an error that is returned from the Database.
What error(s) or behavior you are seeing?
cx_Oracle.DatabaseError: DPI-1037: column at array position 0 fetched with error 1406
We have noticed a case where cx_Oracle is raising an error when thecursor.outputtypehandler
is set withdefaultType
ascx_Oracle.STRING
and works when it is set withcx_Oracle.LONG_STRING
. The issue manifested in our codebase from a SQLAlchemy change, where settingcoerce_to_unicode
was causing thedefaultType
to change. Despite the change indefaultType
, should this error manifest? We would expect cx_Oracle to handle it gracefully and show us the query result.Include a runnable Python script that shows the problem.