[Sqlalchemy-tickets] Issue #4259: version 1.2 breaks correct Boolean handling on Oracle 11g (zzzeek
Brought to you by:
zzzeek
From: Leonid B. <iss...@bi...> - 2018-05-17 07:35:17
|
New issue 4259: version 1.2 breaks correct Boolean handling on Oracle 11g https://bitbucket.org/zzzeek/sqlalchemy/issues/4259/version-12-breaks-correct-boolean-handling Leonid Butenko: Since I have upgraded from sqlalchemy 1.1.13 to 1.2.7 my ingestion scripts have stopped working. I get the following error: ``` sqlalchemy.exc.DatabaseError: (cx_Oracle.DatabaseError) ORA-03115: unsupported network datatype or representation [SQL: u'UPDATE pod SET converge=:converge WHERE pod.sat = :pod_sat AND pod.stime_utc = :pod_stime_utc AND pod.etime_utc = :pod_etime_utc'] [parameters: {'pod_etime_utc': datetime.datetime(2018, 5, 14, 18, 10, 42), 'converge': False, 'pod_stime_utc': datetime.datetime(2018, 5, 14, 18, 5, 42), 'pod_sat': 'M03'}] (Background on this error at: http://sqlalche.me/e/4xp6) ``` the test code is here: ``` import utils.databases as sa import utils.times as dt connection_string = "oracle://user:pass@DBS:1521/dbname" engine = sa.create_engine(connection_string, echo = True, max_overflow = 0, pool_size = 3) _session = sa.orm.sessionmaker() _session.configure(bind=engine) session = _session() Base = sa.ext.declarative.declarative_base() try: class Pod(Base): __table__ = sa.Table("pod", Base.metadata, autoload = True, autoload_with = engine) except: raise IOError, "Cannot connect to database engine. Possibly database does not exist." # Create new object nap = Pod() # Fill row with new information try: nap.sat = "M03" nap.stime_utc = dt.DateTime(2018, 5, 14, 18, 5, 42) nap.etime_utc = dt.DateTime(2018, 5, 14, 18, 10, 42) nap.converge = False session.merge(nap) # Commit session session.commit() del nap except OSError, e: logging.warning(e) del nap # Dispose database engine engine.dispose() ``` I use Oracle 11g, cx_oracle 6.3 and oracle instantclient 12.2. If I change the code and set pod.converge = 1 or 0, everything works perfect. The field is declared as Boolean and I assume it should convert it internally to 1 and 0 as far as Oracle 11g doesn't have a native boolean support. The 'converge' column in the table has a type NUMBER(38,0). |