Skip to content

cx_Oracle 8 DBAPI type objects are no longer hashable #401

@zzzeek

Description

@zzzeek

When testing SQLAlchemy against cx_Oracle master (version 8), our dialect can't work anymore because cx_Oracle types like BLOB, DATETIME are no longer hashable.

Behavior in cx_Oracle 7.x:


Python 3.7.6 (default, Dec 19 2019, 22:50:01) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
>>> cx_Oracle.__version__
'7.2.3'
>>> s = {cx_Oracle.DATETIME, cx_Oracle.CLOB}
>>> 

behavior in cx_Oracle 8:


Python 3.7.6 (default, Dec 19 2019, 22:50:01) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
>>> cx_Oracle.__version__
'8.0.0-dev'
>>> s = {cx_Oracle.DATETIME, cx_Oracle.CLOB}
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'cx_Oracle.DbType'

SQLAlchemy uses sets of cx_Oracle datatypes in order to automate processes that later make calls to things like cursor.setinputsizes() for certain kinds of types. SQLAlchemy can be modified to work around this issue however I don't see why it's unreasonable that a DBAPI datatype object be hashable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions