on_connect AttributeError: 'cx_Oracle.Connection' object has no attribute 'outputtypehandler'

Issue #1775 resolved
Former user created an issue

Hi,

I am using cx_Oracle 4.3.1.

I get the following traceback when I try to initiate a connection. Revision 11a8939f365114ca55a75ebb6f03008fdf04ee6b is the last working version of the code I have tested.

/afs/cern.ch/atlas/offline/external/sqlalchemy/0.6.0/lib/python2.5/site-packages/sqlalchemy/pool.pyc in create_connection(self)
    132 
    133     def create_connection(self):
--> 134         return _ConnectionRecord(self)
    135 
    136     def recreate(self):

/afs/cern.ch/atlas/offline/external/sqlalchemy/0.6.0/lib/python2.5/site-packages/sqlalchemy/pool.pyc in __init__(self, pool)
    212         if ls is not None:
    213             for l in ls:
--> 214                 l.first_connect(self.connection, self)
    215         if pool._on_connect:
    216             for l in pool._on_connect:

/afs/cern.ch/atlas/offline/external/sqlalchemy/0.6.0/lib/python2.5/site-packages/sqlalchemy/engine/strategies.pyc in on_connect(conn, rec)
    137                     if conn is None:
    138                         return
--> 139                     do_on_connect(conn)
    140 
    141                 pool.add_listener({'first_connect': on_connect, 'connect':on_connect})

/afs/cern.ch/atlas/offline/external/sqlalchemy/0.6.0/lib/python2.5/site-packages/sqlalchemy/dialects/oracle/cx_oracle.pyc in on_connect(conn)
    465 
    466         def on_connect(conn):
--> 467             conn.outputtypehandler = output_type_handler
    468 
    469         return on_connect

AttributeError: 'cx_Oracle.Connection' object has no attribute 'outputtypehandler'

Comments (7)

  1. Mike Bayer repo owner

    its not surprising. any way you might upgrade to cx_oracle 5 ? SQLA 0.6 is not going to do very well with cx_oracle 4.

  2. Former user Account Deleted

    I'm not in control of the version of cx_Oracle in my environment (so far as I can tell). Is it backwards compatible? It is used heavily at my institution, which uses environment modification to pull things in.

    I will investigate if it's possible to make it use version 5, but I'm not terribly hopeful, at least in the short term.

    SQLA seemed to be working fine on the last checkout I had - was I lucky? Or has something been introduced since then which breaks version 4 support?

    Thanks.

  3. Mike Bayer repo owner

    the output type handler we're using is to provide better unicode and precision decimal support. We can disable the usage of this handler based on detected cx_oracle version. My concern was that the string/numeric types in use would have to be modified to degrade in the absense of this handler but it looks like they are already set up to do so. If you can try out the attached patch, I can commit it.

  4. Log in to comment