On 5/20/15 3:45 AM, Mehdi wrote:
Hi
Unfortunately i have to work with an old Oracle 9i database. I've
managed to setup cx_oracle 4.4.1 with python2.7 for oracle 9i, but i
need to work with python3 and cx_oracle doesn't support oracle 9i for
python3.x.
it doesn't? cx_oracle supports Py3K fully, do you have a link for where
it fails to work on Oracle 9 ? It's all just OCI and it builds against
whatever oracle client libs you have.
So i tried pyodbc and i can successfully connect to oracle 9i with it.
Now i want to know is there any way to use sqlalchemy with pyodbc in
order to connect to oracle 9i ?
I've tried /"oracle+pyodbc://me:[email protected]/sid"/ but i got this error:
|
sqlalchemy.exc.NoSuchModuleError:Can't load plugin:
sqlalchemy.dialects:oracle.pyodbc
|
we don't have a dialect for that right now. You can make one, though it
might have lots of issues as pyodbc is a difficult driver to work with
in general and might not have support for many features of the Oracle
database, typically this regards poor handling of datatypes (things like
unicode, etc.).
I've attached the most rudimentary dialect possible for this. If you
were to "import oracle_pyodbc", you would then have available an engine
URL like create_engine("oracle+pyodbc://user:pass@DSN"). I don't have an
environment set up to interface ODBC to Oracle here and while this
dialect should be able to make a successful connection, it might fail
very quickly afterwards.
Send me more detail about the Python3/cx_oracle/9i thing.
Thanks.
--
You received this message because you are subscribed to the Google
Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
from sqlalchemy.dialects.oracle.base import OracleDialect, \
OracleExecutionContext
from sqlalchemy.connectors.pyodbc import PyODBCConnector
class OracleExecutionContext_pyodbc(OracleExecutionContext):
pass
class OracleDialect_pyodbc(PyODBCConnector, OracleDialect):
execution_ctx_cls = OracleExecutionContext_pyodbc
pyodbc_driver_name = "Oracle"
dialect = OracleDialect_pyodbc
from sqlalchemy.dialects import registry
registry.register("oracle.pyodbc", "oracle_pyodbc", "OracleDialect_pyodbc")