Connect to ScaleChamp Managed PostgreSQL with SQLAlchemy
Mike Faraponov
Posted on October 10, 2020
Create database instance in Control Panel:
Then connect to it from your python application:
from sqlalchemy import create_engine
conn_args = {
"sslmode": "verify-full",
"sslrootcert": "<path to your ca.pem downloaded from UI>",
}
engine = create_engine("postgresql://<user>:<password>@<hostname>:5432/ssndb", connect_args=conn_args)
conn = engine.connect()
To make sure no one can gain access to your database accept allowlisted IPs checkout firewalls section.
Voa'la. See you at ScaleChamp
💖 💪 🙅 🚩
Mike Faraponov
Posted on October 10, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.