I am currently migrating an existing Python program that uses SQLAlchemy, but almost exclusively via using the SQLAlchemy engines for use in Pandas dataframes (e.g., pandas to_sql). Currently the connection strings used in creating the engine are those of another database (namely MySQL), and accessing databases (analogous to Postgres schemas) is easily done. How would I best specify the schema (and not merely the Postgres database which contains them) within a given engine?
Edit: Someone seems to have labeled this question as being a duplicate. It is not. I am not looking to auto-generate queries by using Sessions; I am looking to create connection strings in order to create SQLAlchemy engines for use in Pandas' to_sql function.
You can use blaze to connect to the postgreSQL and Metadata from SQL Alchemy
from blaze import data
from sqlalchemy import MetaData
ds = data(MetaData('postgresql://localhost/test', schema='my_schema'))
before using blaze, install it by:
pip install blaze
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With