Redshift Adapter
Generate Amazon Redshift SQL from your model.
What the adapter emits
- Identifiers in
"double quotes"; bare column names in expressions are lowercased. - Date literals as
'2026-01-01'::DATE; grain truncation asDATE_TRUNC('month', x); parts withEXTRACT(YEAR FROM x),EXTRACT(DOW FROM x). - CTEs for the per-fact subqueries and a
FULL OUTER JOINwhen a query blends measures from two facts. - No array functions:
expression.array: trueis not supported on this adapter.
Configuration
redshift_dw:
adapter: redshift
name: Redshift Warehouse
tier: warm
host: default-workgroup.123456789012.us-east-1.redshift-serverless.amazonaws.com
port: 5439
database: analytics
schema: analytics
username: reader
# password: never here; zsql deploy strips it if present
Connection fields
The server never connects to Redshift: it has no database driver in it, and the only keys the deployed model keeps are adapter, tier and the name. Your application runs the statement it gets back, with its own credentials.
zsql on this machine does connect, read-only, for zsql catalog, zsql sample and zsql run. It rides the Postgres wire with Redshift’s own catalog queries: username, a password, port 5439, and sslmode. Secrets go in .zsql or ZSQL_DS_<KEY>_<FIELD>, never in datasources.yml; zsql deploy strips password from the file if present. See Connecting to a warehouse.
Notes
- Postgres-like, not Postgres. Redshift speaks the Postgres wire protocol but its SQL differs; the adapter emits Redshift forms where they diverge. Write
expression.sqlfor Redshift:approximate count(distinct x),listagg,median. - Pair with a hot tier. Redshift is a good system of record; route recent-data queries to ClickHouse or DuckDB in front of it with a partition. See Semantic Routing.