PostgreSQL
This connector is used to query a PostgreSQL database using SQL.
Connection configuration
Two connection modes are available: password and connection_string.
Password mode
| Name | Mandatory | Default | Description |
|---|
| mode | no | password | Connection mode: password or connectionstring |
| hostname | yes | | Server hostname or IP address |
| database | yes | | Database name |
| username | yes | | Username |
| password | yes | | Password |
| port | no | 5432 | Port number |
| sslcontext | no | false | Enable SSL connection |
Connection string mode
| Name | Mandatory | Default | Description |
|---|
| mode | yes | | Must be connectionstring |
| connectionstring | yes | | SQLAlchemy connection string |
Example (password mode)
connections:
postgresql_connection:
type: postgresql
hostname: my-server.postgres.database.azure.com
database: my_database
username: my_user
password: $var.pg_password
port: 5432
ssl_context: true
Example (connection string mode)
connections:
postgresql_connection:
type: postgresql
mode: connection_string
connection_string: postgresql+pg8000://user:password@host:5432/database
Test case configuration
| Name | Mandatory | Default | Description |
|---|
| query | yes | | SQL query to execute |
Example
Example PostgreSQL:
source:
type: postgresql
connection: postgresql_connection
query: |
SELECT *
FROM employees
WHERE hire_date < '2000-01-01'
expected:
type: csv
path: data/employeesbefore2000.csv
Requirements
pip install pg8000 (included in ploosh full installation)