文档/Amazon Redshift
此页面尚未翻译,当前显示英文版本。 查看英文版本
Amazon Redshift
AWS managed data warehouse, wire-compatible with PostgreSQL. Read-only.
At a glance
- Category — Relational
- Query language — SQL
- Default port — 5439
- URI scheme —
redshift
Amazon Redshift driver for DBFlux (read-only v1), built directly on the postgres wire client rather than on dbflux_driver_postgres.
Features
- Relational driver (
DatabaseCategory::Relational,QueryLanguage::Sql) that speaks the PostgreSQL wire protocol against a Redshift cluster or Redshift Serverless endpoint. - Connection form with host, port (default
5439), database, user, password, SSL/sslmode(disable/allow/prefer/require/verify-ca/verify-full), a connection-URI mode (redshift://..., normalized internally topostgresql://...), and SSH tunneling. - Custom TLS trust and mutual TLS: for TLS-enabled modes a pinned private root CA (PEM) is added to the trust store on top of the system roots, and a client certificate + private key (PEM/PKCS#8) enable mutual TLS. Cert material is loaded per connection from the paths configured in the form; validation is never weakened (
verify-ca/verify-fullstill reject an untrusted certificate). A missing, unreadable, or malformed cert/key file surfaces as a clear connection error instead of silently falling back to the system trust store, and private-key contents are never logged. - Schema introspection over
information_schemafor databases, schemas, tables, views, and columns, withColumnKindclassification (timestamp/integer/float/text) mirroring standard PostgreSQL OIDs. - Redshift-only extended types (
SUPER,VARBYTE,GEOMETRY,GEOGRAPHY,HLLSKETCH) classify asColumnKind::Textand render as text; any other unrecognized OID falls back to a defensive UTF-8 text decode instead of panicking. - Table details surface Redshift-specific storage metadata through the generic
TableInfo.storage_hintsseam (read fromSVV_TABLE_INFOandPG_TABLE_DEF): distribution key (KEY/EVEN/ALL/AUTO, with the key column when applicable) and sort key (compound or interleaved, with its ordered columns). Declared primary key, foreign key, and unique constraints are still surfaced through the standard core metadata shapes, each labeled advisory/non-enforced — Redshift accepts but never enforces these constraints, and no index list is fabricated from them. - Query execution (
SELECT/browse) returns rows with typed columns via the standardConnection::executepath; query cancellation is supported through the wire client’s cancel token. RedshiftErrorFormattermaps common connection and query failures (timeouts, refused connections, authentication failures, unreachable clusters,SQLSTATE-bearing query errors) to clear, driver-formatted messages instead of raw debug output.- Reports
application_nameasdbflux/<version>on every connection, unless the connection URI already sets its ownapplication_namequery parameter.
Limitations
- Read-only:
DriverMetadata.capabilitiesomitsINSERT,UPDATE,DELETE,RETURNING,BULK_INSERT,TRUNCATE_TABLE, and all DDL/transactional-DDL flags. There is no inline grid edit and no mutation/visual-query builder for this driver.Connection::executeadditionally rejects any non-read statement at the wire layer with an explicit error, so a write attempt never becomes a silent no-op. - Single-statement only:
Connection::executeruns one read-only statement at a time. Multi-statement input (e.g.SELECT 1; SELECT 2) is rejected with an explicit error before reaching the wire; a single optional trailing;is allowed, and;inside string literals, quoted identifiers, or comments is not treated as a separator. - No
INDEXEScapability: Redshift has no true index structures, soTableDetails.indexesis alwaysNonerather than being synthesized from the (non-enforced) primary key. - No triggers: Redshift does not support triggers, so none are discovered or surfaced.
- No IAM/SSO-based authentication. Only username/password (optionally via SSH tunnel) is supported; Redshift’s IAM-based
GetClusterCredentialsand browser SSO flows are not implemented. - Client certificates for mutual TLS must be supplied as a PEM certificate plus a PKCS#8 PEM private key (the two are configured as separate file paths); a combined PKCS#12 bundle is not accepted. The PEM parsing and error handling of the root-CA / client-cert load path are covered by unit tests, but the end-to-end TLS handshake against a cluster fronted by a private CA or requiring a client certificate is validated only by an
#[ignore]d live integration test (redshift_live_verify_full_with_private_ca_and_client_cert), since no local or Docker-based Redshift engine exists. - No
COPY/UNLOADsupport and no data-transfer/bulk-export integration specific to Redshift. - No query-plan visualization (
EXPLAINoutput is not parsed or rendered). - No instance metrics or instance inspector (
INSTANCE_METRICS/INSTANCE_INSPECTORare not declared). - The extended-type OID values used for
SUPER/VARBYTE/GEOMETRY/GEOGRAPHY/HLLSKETCH, and the exactSVV_TABLE_INFO/PG_TABLE_DEFquery shapes used for storage hints, are validated only by#[ignore]d live integration tests (crates/dbflux_driver_redshift/tests/live_integration.rs), since no local or Docker-based Redshift engine exists. Run them explicitly against a real cluster withcargo nextest run -p dbflux_driver_redshift --run-ignored all. NUMERIC/DECIMALvalues ARE decoded: the driver parses the PostgreSQL binaryNUMERICwire format directly into an exactValue::Decimalstring (integer/fractional reconstruction to the column’s declared scale, plusNaN/±Infinity). Malformed payloads fall back safely rather than corrupting data. The binary decoder is covered by unit tests over synthetic wire payloads; end-to-end fidelity is still validated only against a live cluster via the#[ignore]d integration tests.