DEV Community

Mike Faraponov for ScaleChamp

Posted on • Edited on

1 2

Connect to ScaleChamp Managed PostgreSQL with SQLAlchemy

Create database instance in Control Panel:

  1. Select service, cloud, region:
    Alt Text

  2. Select plan:
    Alt Text

  3. Wait until instance will be in RUNNING state:
    Alt Text

  4. 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()
Enter fullscreen mode Exit fullscreen mode

To make sure no one can gain access to your database accept allowlisted IPs checkout firewalls section.
Voa'la. See you at ScaleChamp

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs