Skip to main content

continuo-trino-adapter

Trino (Iceberg connector) engine-adapter library for Continuo python nodes. TrinoAdapter implements continuo_engine_contract.port.WarehouseAdapter (from the continuo-engine-contract package) — one class covering both the data plane (fetch / ensure_table / load) and release-time validation (ensure_schema / drop_schema / build_empty_from_sql / build_empty_from_columns / clone_empty_from_prod / check_binds) — and registers itself under entry-point group continuo_engine.adapters as trino.

Connection env: TRINO_HOST, TRINO_CATALOG (required); TRINO_PORT (default 8080), TRINO_USER (default continuo), TRINO_HTTP_SCHEME (default http), TRINO_PASSWORD (optional; requires TRINO_HTTP_SCHEME=https).

The config: vocabulary is the union of the two vocabularies this adapter inherited from the merge: partitioning, sorted_by, format, and format_version. format takes the PARQUET / ORC / AVRO allowlist on every path. location and extra_properties are deliberately absent — see the adapter module docstring.

No multi-statement transactions

Unlike the postgres runtime adapter, Trino/Iceberg has no multi-statement transactions, so load() cannot be a single atomic TRUNCATE+INSERT. Two atomic-replace primitives were verified live (Trino 483 + Iceberg REST catalog) before choosing one — see the full writeup in continuo_trino_adapter/adapter.py's module docstring:

  • CREATE OR REPLACE TABLE t AS SELECT * FROM stage is a single Iceberg metadata commit but silently drops NOT NULL constraints on the replaced table (verified live: a NULL insert into a "NOT NULL" column succeeds afterwards, and this connector/version does not support re-adding NOT NULL via ALTER TABLE ... ALTER COLUMN ... SET NOT NULL). Rejected for this reason.
  • CREATE TABLE stage (LIKE target INCLUDING PROPERTIES) at a fresh sibling Iceberg location + populate + a two-statement ALTER TABLE ... RENAME TO swap preserves the target's exact columns, NOT NULL constraints, partitioning, format, and other connector properties (verified live). This is what load() uses.

The swap's exact atomicity guarantee: nothing under the target name is touched until every row has been inserted into staging, so a failure before the swap begins (e.g. a NOT-NULL-violating row) leaves the prior target contents untouched. The two-statement rename swap itself is not single-statement atomic — there is a brief window between the two renames during which the target name refers to neither table. load() makes a best-effort recovery attempt (rename the private old relation back) if the second rename raises, and best-effort drops only a private staging relation created by that load. If recovery itself fails, the logged private old relation remains available for manual recovery because it contains the original target data.

load() assumes a single writer per table: Continuo's scheduler runs at most one Job per node at a time. Concurrent load() calls against the same table are unsupported because their target renames would race. Each load uses UUID-named private swap relations, so distinct targets cannot collide with each other or with legitimate user tables.

NOT NULL is supported here

Verified live against Trino 483 + the Iceberg REST catalog: NOT NULL column constraints in CREATE TABLE are supported and enforced by INSERT (CONSTRAINT_VIOLATION on a NULL value). ensure_table() emits NOT NULL for nullable=False columns, same as the postgres adapter.

Type-name mapping

The contract's SQL-type grammar (copied verbatim from the postgres adapter, same regex) admits spellings Trino does not recognize as type names: TEXT, DOUBLE PRECISION, NUMERIC(p,s). These are mapped to Trino's own spellings (VARCHAR, DOUBLE, DECIMAL(p,s)) after the grammar guard has already rejected anything injection-shaped. Every other grammar token is valid Trino DDL unchanged.

Identifier quoting

The trino DBAPI has no psycopg2-style sql.Identifier. Catalog, schema, table, and column names are double-quoted by hand, with every embedded double quote doubled. This preserves legal delimited identifiers such as sales-prod, order id, and has"quote without allowing names to escape their quotes.

Verification tier: unit tests are mock-free pure-logic tests (type-grammar validation, type-name mapping, identifier quoting, location derivation, Arrow table construction from rows); DDL/swap behavior (schema/table creation, load-owned swap relations, property and NOT NULL preservation, failure cleanup) is verified against a live Trino 483 + Iceberg REST stack in tests/test_integration_runtime_trino.py.

Metadata

Release files for continuo-trino-adapter 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for continuo-trino-adapter 0.2.0
File Size Uploaded
continuo_trino_adapter-0.2.0.tar.gz 24.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for continuo-trino-adapter 0.2.0
File Interpreter ABI Platform
continuo_trino_adapter-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 38.4 kB

Release files / continuo_trino_adapter-0.2.0.tar.gz

Download URL continuo_trino_adapter-0.2.0.tar.gz
Size 24.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f753bcd326849cf0c19cf9d3115c3cf08305703082fd0447e14d7c68c581eacd
BLAKE2b-256 checksum
How to use checksums
d7ca07f2bdca4a92e612f4466987370b9a5c6135b33e3deeea6ba568a83730ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / continuo_trino_adapter-0.2.0-py3-none-any.whl

Download URL continuo_trino_adapter-0.2.0-py3-none-any.whl
Size 13.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
062c85674ec0265fb49238c4715a2bbf92037ec87e9e98a63c6971ca6facaea4
BLAKE2b-256 checksum
How to use checksums
97c508b507ab1695d045304e630f02fda4b254c3c09a1990ab42ac807ea3f2f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

0.2.1

2 release files

This release

0.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page