I have a connection string that looks like this
con_str = \"myuser/mypass@oracle.sub.example.com:1521/ora1\"
Where ora1
is the
For those looking for how to specify service_name instead of SID.
From changelog for SQLAlchemy 1.0.0b1 (released on March 13, 2015):
[oracle] [feature] Added support for cx_oracle connections to a specific service name, as opposed to a tns name, by passing
?service_name=
to the URL. Pull request courtesy Sławomir Ehlert.
The change introduces new, Oracle dialect specific option service_name
which can be used to build connect string like this:
from sqlalchemy import create_engine
from sqlalchemy.engine import url
connect_url = url.URL(
'oracle+cx_oracle',
username='some_username',
password='some_password',
host='some_host',
port='some_port',
query=dict(service_name='some_oracle_service_name'))
engine = create_engine(connect_url)