Home > database >  Trying to connect to SQLalchemy engine
Trying to connect to SQLalchemy engine

Time:01-03

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: data-handling-project-readonly.cq2e8zno855e.eu-west-1.rds.amazonaws.com
RDS_PASSWORD: AiCore2022
RDS_USER: aicore_admin
RDS_DATABASE: postgres
RDS_PORT: 5432

CodePudding user response:

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.

CodePudding user response:

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

  • Related