Installation
Install the PostgreSQL connector:Configuration
Configuration Parameters
Database hostname to connect to
Database port to connect to
Database name to connect to
Username for authentication
Password for authentication
Default schema to use. Sets the
search_path for the connectionAdditional connection options string
SSL Configuration
Enable SSL/TLS encryption for secure connections:connection.yaml
SSL Parameters
SSL mode:
allow, prefer, require, verify-ca, or verify-fullWhen false, accepts certificates with untrusted authorities. Only disable if absolutely necessary
Connection String
You can also use a PostgreSQL connection string:connection.yaml
Features
Type Mapping
PostgreSQL types are mapped to Evidence types:- Numbers: NUMERIC, MONEY, INT2, INT4, INT8, FLOAT4, FLOAT8
- Strings: VARCHAR, TEXT, CHAR, JSON, XML, NAME
- Dates: DATE, TIME, TIMETZ, TIMESTAMP, TIMESTAMPTZ
- Booleans: BOOL
Type Parsing Overrides
The connector overrides default PostgreSQL type parsing for better JavaScript compatibility:- BIGINT (20): Parsed as integer instead of string
- NUMERIC (1700): Parsed as float instead of string
- MONEY (790): Parsed as float with currency symbols removed
- JSON/JSONB: Returned as strings to preserve exact formatting
Column Name Normalization
PostgreSQL column names are automatically converted to lowercase for consistency.Schema Support
Set a default schema using theschema parameter. This sets the PostgreSQL search_path for all queries:
Cursor-based Streaming
The connector uses PostgreSQL cursors to stream large result sets efficiently in batches (default 100,000 rows).Example Query
Create a SQL file in your Evidence project:queries/user_activity.sql
Cloud Providers
Amazon RDS
connection.yaml
Google Cloud SQL
connection.yaml
Azure Database for PostgreSQL
connection.yaml
Troubleshooting
Connection timeout errors
Connection timeout errors
- Verify the host and port are correct
- Check firewall rules allow connections from your Evidence instance
- For cloud databases, ensure your IP is whitelisted
SSL/TLS errors
SSL/TLS errors
- Use
sslmode: requirefor encrypted connections - For self-signed certificates, you may need to set
rejectUnauthorized: false(not recommended for production) - For cloud providers, download and reference their CA certificate
Schema not found
Schema not found
Ensure the specified schema exists and your user has the USAGE privilege:
Permission denied errors
Permission denied errors
Grant SELECT permissions on required tables: