This connector allows to connect to a PostgreSQL database and execute SQL queries.

Connection configuration

Password mode

Definition

NameMandatoryDefaultDescription
modenopasswordChange the connection mode. Can be "password" or "connectionstring". "connectionstring" mode allow to use a custom connection string.
hostnameyesTarget host name
databaseyesTarget database name
usernameyesUser name
passwordyesUser password
portno3306Port to use by the connection
ssl_contextNoFalseSet True if the server require a secure transport
⚠️ it's highly recommended to use a parameter to pass the password value

Example

postgresql_example:
  type: postgresql
  hostname: ploosh.postgresql.database.azure.com
  database: SampleDB
  username: sa_ploosh
  password: $var.saplooshpassword 
  ssl_context: true

Definition

Connection string mode

NameMandatoryDefaultDescription
modenopasswordUse "connectionstring" value to use custom connectionstring
connection_stringyesConnection string use to access in the database. Refer to SQLAlchemy documentation to get the accepted format

Example

postgresql_example:
  type: postgresql
  mode: connection_string
  connectionstring: "postgresql+pg8000://saploosh:$var.saplooshpassword@ploosh.postgresql.database.azure.com/SampleDB"

Test case configuration

Definition

NameMandatoryDefaultDescription
connectionyesThe connection to use
queryyesThe query to execute to the database

Example

Example PostgreSQL:
  source:
    connection: postgresql_example
    type: postgresql
    query: | 
        select * 
            from employees
            where hire_date < "2000-01-01"
  expected:
    type: csv
    path: data/employeesbefore2000.csv