Skip to content

Instantly share code, notes, and snippets.

View mindshoot's full-sized avatar

Tim Hodson mindshoot

  • Amersham, Buckinghamshire
View GitHub Profile
@mindshoot
mindshoot / oracle_sqlalchemy.md
Last active January 20, 2022 17:03
Connecting to Oracle in SQLAlchemy when all you have is a cx_Oracle connection string

SQLAlchemy supports creating an engine to wrap a cx_Oracle connection, without having to attempt to translate the connection string into a form supported by SQLAlchemy. This is good for normal SQLAlchemy code and also for using it to pull data using pandas. Here it is in use:

import pandas as pd
from sqlalchemy import create_engine
import cx_Oracle

connection_string = 'user/pass@//host:port/name'