skip to Main Content

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

2

Answers


  1. 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.

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search