Skip to main content

PostgreSQL

PostgreSQL datasources use a high-performance native driver for optimized data transfer. No ODBC installation is required.
See Supported Data Formats for database source categories and schema column types supported on PostgreSQL connections.

Connection configuration

URI format

Required fields

The native driver communicates with the database using the PostgreSQL binary protocol and produces data batches directly, avoiding row-by-row conversion overhead.

Example connection

Dataset configuration (data_args)

Required fields

Optional fields

table_options entry

Each entry in table_options describes a table to query:

Complete example

Connection

Dataset

Set data_dt_format to true when using native PostgreSQL timestamp or timestamptz columns. CloudQuant Data Liberator will auto-detect the datetime type and convert directly without string parsing.

Partitioned table example

For tables partitioned by date (e.g., trades_2024_01, trades_2024_02):

Driver and dependencies

The native driver is bundled with CloudQuant Data Liberator. No additional driver installation is needed on the host system.

Troubleshooting

Connection refused

Verify the PostgreSQL server is accepting connections on the specified host and port. Check pg_hba.conf for client authentication rules.

Authentication failed

Ensure the username and password in the connection match a valid PostgreSQL role. Check that the role has CONNECT privilege on the database and SELECT privilege on the target tables.

SSL/TLS errors

If the server requires SSL, append ?sslmode=require to the URI:
Using sslmode=disable in production is not recommended. Always use sslmode=require or sslmode=verify-full when connecting over untrusted networks.

Empty results from partitioned tables

Verify that dt_regex correctly matches the table name suffix and that dt_format corresponds to the captured groups. Test the regex against your actual table names.

Slow queries

  • Increase batch_size for large result sets (up to 100000).
  • Ensure the datetime and key columns are indexed in PostgreSQL.
  • Use table_like to target specific tables rather than scanning all partitions.