Trying to connect to SQLalchemy engine

Question:

So i have a YAML file with the following parameters which I read into a dictionary
The part i don’t get is how to connect it to the SQL engine, I have looked at the documentation and what i need is to break the creds as

dialect+driver://username:password@host:port/database

but i’m not sure what the dialect and drive is in this case

RDS_HOST: XXXX.YYYYY.eu-west-1.rds.amazonaws.com
RDS_PASSWORD: XXXXXX
RDS_USER: XXXXXX
RDS_DATABASE: postgres
RDS_PORT: XXXX
Asked By: Darman

||

Answers:

You can try this.

connection_string = f"postgresql://{RDS_USER}:{RDS_PASSWORD}@{RDS_HOST}:{RDS_PORT}/{RDS_DATABASE}"

I’m not sure if this is what you are looking for.

Answered By: JukeboxHero

The dialect can either be mysql or any relational database management system it supports.

For mysql the driver is mysqldb.

For postgresql the driver is psycopg2.

Note: You may need to install the driver too

Answered By: Maxwell D. Dorliea
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.