python - SQLAlchemy unstable behaviour with Oracle -
i've been trying resolve sqlalchemy issue i'm having , narrowed down simple script:
#!/usr/bin/env python flask import flask flask.ext.sqlalchemy import sqlalchemy app = flask(__name__) app.config["sqlalchemy_database_uri"] = "oracle+cx_oracle://<user>:<password>@<sid>" db = sqlalchemy(app) class instance(db.model): id = db.column(db.integer, primary_key=true) app.app_context(): instance = db.session.query(instance).filter(instance.id == 105250).first() print(instance)
the instance id 105250 indeed exists in database, results i'm getting quite surprising:
% x.py <__main__.instance object @ 0x7f65461cdef0> % x.py <__main__.instance object @ 0x7f0c09aa2ef0> % x.py none % x.py <__main__.instance object @ 0x7fd1c7a9eef0> % x.py none
can explain how prevent , fix unstable behaviour?
i found root cause. posting here, in case runs same issue.
the problem caused unstable cx_oracle 5.2.0 driver. downgrading 5.1.3 fixed issue.
Comments
Post a Comment