Skip to content

feat(connectors): add Trino data source connector#322

Open
bazooka720 wants to merge 2 commits into
Kaelio:mainfrom
bazooka720:feat/trino-connector
Open

feat(connectors): add Trino data source connector#322
bazooka720 wants to merge 2 commits into
Kaelio:mainfrom
bazooka720:feat/trino-connector

Conversation

@bazooka720

Copy link
Copy Markdown

What

Adds Trino as a data source, alongside the existing warehouse connectors (Snowflake, BigQuery, ClickHouse, Postgres, MySQL, SQL Server, SQLite).

Because Trino federates many catalogs behind a single endpoint, the connector treats all catalogs as first-class: it discovers every non-system catalog (or an explicit catalogs allowlist) via system.metadata.catalogs, introspects each through information_schema, and emits catalog-qualified catalog.schema.table tables.

How

  • connectors/trino/
    • KtxTrinoScanConnectorintrospect (per-catalog), listSchemas/listTables (catalog-namespaced), testConnection, sampleTable, sampleColumn, executeReadOnly, cleanup. Talks to Trino via an injectable KtxTrinoClient factory backed by trino-client (lazy import), so it is unit-testable with a fake.
    • KtxTrinoDialectthree-part identifier shape, ANSI double-quoting, TABLESAMPLE BERNOULLI, Trino-to-dimension type mapping.
  • Registration — driver/dialect registries, KtxConnectionDriver union, KtxScopeConfigKey (catalogs), zod warehouse schema, sql-analysis trino (sqlglot) mapping, and the setup wizard (catalog scope discovery, default port 8080).
  • All SQL routes through the existing read-only gate; reads use SELECT-able system tables (no SHOW).

Notes / scope

  • hasHistoricSqlReader: false — query-history ingestion deferred (same as ClickHouse/MySQL/SQL Server today).
  • Auth: basic / user (password optional via BasicAuth); OAuth2/Kerberos not wired yet.
  • estimatedRows left null (no portable cheap row-count in Trino).

Testing

  • tsc -p tsconfig.json and tsconfig.test.json — clean
  • Biome — clean
  • Full vitest suite green (3,024 tests); new test/connectors/trino/{dialect,connector}.test.ts cover all-catalogs discovery, allowlist, tableScope, sampling, read-only enforcement, and config/URL/ssl parsing
  • Updated existing drivers.test.ts fixtures for the new driver

Add a Trino connector alongside the existing warehouse connectors
(Snowflake, BigQuery, ClickHouse, Postgres, MySQL, SQL Server, SQLite).

Trino federates many catalogs behind one endpoint, so the connector
discovers every non-system catalog (or an explicit `catalogs` allowlist)
and introspects each via information_schema, emitting catalog-qualified
(catalog.schema.table) tables. SQL goes through the read-only gate and
maps to the sqlglot 'trino' dialect for analysis.

- connectors/trino: KtxTrinoScanConnector + KtxTrinoDialect (three-part,
  ANSI quoting, TABLESAMPLE BERNOULLI), injectable trino-client factory
- register in driver/dialect registries, scan driver union, zod schema,
  sql-analysis dialect map, setup wizard (catalog scope, port 8080)
- tests: dialect + connector suites (fake client); update driver fixtures

Verified: tsc (src+test), biome, full vitest suite green.
@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown

@bazooka720 is attempting to deploy a commit to the Kaelio Team on Vercel.

A member of the Team first needs to authorize it.

@luca-martial

Copy link
Copy Markdown
Contributor

Thanks @bazooka720 , we'll review and get back to you soon!

@luca-martial
luca-martial requested a review from andreybavt June 28, 2026 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants