Skip to content

Error connecting to python-oracledb #215

Open

Description

@centeiol

Hello ,

I opened a Issue at sqlalchemy regarding a connection to oracle wiyh new driver oracle+oracledb, and they tell me that this issue was related to ipython-sql.

The trhread
sqlalchemy/sqlalchemy#8676 (reply in thread)

Code

import oracledb
import pandas as pd
import sqlalchemy

%reload_ext sql
#%sql oracle+oracledb://user:pass@host-scan.domain.net:1521/?service_name=XPTO.domain.net

sqlalchemy.version

Error

init() got an unexpected keyword argument 'bind'
Connection info needed in SQLAlchemy format, example:
postgresql://username:password@hostname/dbname
or an existing connection: dict_keys([])
'2.0.0b1'

Please coul you help

Regards

Activity

  1. ellipticview commented on Nov 27, 2022

    @ellipticview

    Until sqlalchemy supports python-oracledb, a workaround is documented here:
    https://python-oracledb.readthedocs.io/en/latest/user_guide/appendix_c.html#python-frameworks-sql-generators-and-orms.

    So you can use python-oracledb like this, which is very useful for running on MacOS M1 as no Oracle instant client is required:

    import sys
    import oracledb
    oracledb.version = "8.3.0"
    sys.modules["cx_Oracle"] = oracledb
    import cx_Oracle
    
    %load_ext sql
    
    %sql oracle+cx_oracle://scott:tiger@server.domain.com:1521/?service_name=ABC
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions