I would like to set up an oracledb as a datasource but can't get the syntax. Is this even possible?
import oracledb
from sqlalchemy import create_engine
import getpass
username = getpass.getuser()
userpwd = getpass.getpass()
dsn="my_server"
# connect to oracle database
connection=oracledb.connect(
user=username,
password=userpwd,
dsn=dsn
)
# create engine
engine = create_engine('oracle+oracledb://', creator=lambda: connection)
This is successful for connecting and passing to, for example pandas.read_sql.
But I want to use gx:
import great_expectations as gx
context = gx.get_context()
context.sources.add...?
I tried to get a connection string
cp = oracledb.ConnectParams(user=username, password=userpwd,host=dsn)
conn_string = cp.get_connect_string()
datasource = context.sources.add_sql(
name="my_datasource", connection_string=conn_string
)
But this dowsn't work
TestConnectionError: Attempt to connect to datasource failed with the following error message: Unable to create a SQLAlchemy engine due to the following exception: Could not parse SQLAlchemy URL from string '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myserver)(PORT=1521)))'
Any ideas?