PostgreSQL
Configuration reference for the PostgreSQL batch source: connectivity and grants, source options, sample configs, and troubleshooting for connection and incremental-load failures.
PostgreSQL is a mature, feature-rich open-source relational database. Nilus reads from PostgreSQL as a batch source through the standard PostgreSQL SQL path, with optional incremental ingestion driven by a monotonic key column.
For row-level change capture from PostgreSQL, use the PostgreSQL (CDC) instead.
Requirements
Connectivity and credentials must both be in place before the pipeline can run.
Connectivity
The Nilus runtime must reach the PostgreSQL host on the configured port (default
5432).The configured user must be able to connect to the target database and
SELECTfrom the target tables.For network-isolated PostgreSQL (RDS, Cloud SQL, private endpoints), allowlist the runtime egress IP on the database side.
Required parameters
These can be supplied via a Depot or via Instance Secrets.
host
Yes
-
PostgreSQL host name.
port
No
5432
PostgreSQL port.
database
Yes
-
Source database name.
username
Yes
-
PostgreSQL user with SELECT access on the target tables.
password
Yes
-
Password for the PostgreSQL user.
sslmode
No
server default
Optional SSL mode: disable, allow, prefer, require, verify-ca, verify-full.
Database-side permissions
Grant at minimum:
The last ALTER DEFAULT PRIVILEGES ensures the user keeps SELECT on tables created in <schema_name> after the grant.
URI format
Depot-backed equivalent (recommended for production):
Source options
source_table
Yes
Fully qualified table name in <schema>.<table> form (e.g. public.orders).
incremental_key
No
Timestamp or numeric column used to identify newly visible rows for each run. Use a monotonic column (updated_at, sequence-backed id).
interval_start
No
Optional ISO-8601 lower bound for the extraction window. Useful for one-off backfills.
interval_end
No
Optional ISO-8601 upper bound for the extraction window.
page_size
No
Rows per extraction batch (default 50000). Lower it for wide tables that strain runtime memory.
sql_reflection_level
No
full (default) or reduced, controls how thoroughly Nilus reflects the source schema before extraction. Reduce on very wide tables for faster startup.
sql_limit
No
Caps total rows extracted per run. Use for sampling and validation, not for production.
sql_exclude_columns
No
Comma-separated column names to skip during extraction. Useful for dropping large blob / debug columns.
type_hints
No
Object map of column_name: <type> to override inferred types. Supported types: text, bigint, bool, timestamp, date, decimal, double, binary, json, time.
max_table_nesting
No
String. "0" for fully flattened analytics-friendly output (default for SQL sources); raise to "1" or "2" only when downstream consumers expect nested structures.
Note There is no separate
schemaoption. The schema is inferred from the<schema>.<table>form ofsource_table.
Sample Nilus configs
Each example below is self-contained and uses the current Nilus pipeline shape.
Batch, incremental ingestion to Lakehouse
Bounded backfill window
Behavior and capabilities
Compute model: Nilus drives the source through the PostgreSQL SQL endpoint as a regular client. There is no replication-slot or logical-decoding interaction in batch mode.
Object model: standard PostgreSQL tables (and views) addressed as
<schema>.<table>.Pipeline type:
batchonly on this page; for row-level change capture see the PostgreSQL (CDC).Identifier case: PostgreSQL folds unquoted identifiers to lower-case. Either keep
source_tablelower-case, or quote identifiers consistently across upstream DDL and the manifest.Custom queries: supply
source_table: "query:SELECT ... FROM ..."to extract from a hand-authored SQL query instead of a single table. Combined withincremental_key, the query body should reference the column so the engine can apply the incremental filter.Lakehouse decimals: table reads preserve source precision and scale (
NUMERIC(20,4)becomes Icebergdecimal(20,4)).query:extracts store decimals as Icebergdecimal(38,9). Do not use both extract styles with the samedest_table.Performance tuning: see Optimize Sink Datasets for the full list of source / sink shape knobs (
page_size,loader_file_size,partition_by,cluster_by).
Troubleshooting
password authentication failed for user …
Wrong credentials, user dropped, or the password rotated upstream.
Re-check the credentials and confirm the user still exists with the same password in PostgreSQL.
connection to server at "<host>", port <port> failed: timeout expired
Network path blocked (security group, firewall, private subnet).
Verify the runtime egress IP is allowlisted on the database side and the host/port are reachable from the runtime.
permission denied for table <name>
The user has CONNECT on the database but not SELECT on the target schema.
Run the GRANT SELECT ON ALL TABLES IN SCHEMA … block in the Permissions section above and re-run.
SSL connection has been closed unexpectedly / SSL SYSCALL error
sslmode does not match what the server requires; common with managed PG that enforces require or higher.
Set sslmode=require (or verify-full with a CA bundle) in the URI.
Run extracts the full table every time despite incremental_key
The column is not monotonically increasing in the source (rows mutated without updating updated_at), or the pipeline state was reset between runs.
Pick a column that is genuinely monotonic, or rely on a sequence-backed id. If the state was lost, the next run will reseed correctly from the latest watermark.
Wide tables OOMKill the runtime
page_size (default 50000) holds too much data in memory for very wide rows.
Lower page_size to 25000 or 10000; see Optimize Sink Datasets for the full memory-bounding playbook.
ValueError: Cannot serialize value, scale of value does not match type decimal(38, 9): 4
The Lakehouse table was created by a query: extract (decimal(38,9)), then a table read tried to write source-scale decimals such as NUMERIC(20,4) — or the reverse.
Keep one extract style per table. Point dest_table at a new table, or drop and reload.
Related docs
PostgreSQL: companion CDC connector for row-level change capture.
PostgreSQL: companion destination connector.
PostgreSQL partitioned tables for CDC: runbook for partitioned-table sources.
Optimize sink datasets: guidance on
incremental_strategy,partition_by,cluster_by, and other shape settings.
Last updated
Was this helpful?