Skip to content

Introduction ​

KarhutlaSQL is an Apache Arrow Flight SQL server on top of DuckDB, written in Go. Clients connect over gRPC (optionally TLS/mTLS), authenticate with a local password or an OIDC token, and send SQL. The server checks the caller's privileges, rewrites the statement for masking and row-level security, schedules it in a resource group, runs it on DuckDB, and streams the result back as Arrow record batches — recording an audit event and per-column access history on the way.

Clients that do not speak Flight SQL can use the optional PostgreSQL wire listener or the HTTP Arrow endpoint, outside parties can receive tables through Delta Sharing, and scheduled jobs run reports and refresh materialized tables. All of them are translated into Flight SQL statements inside the server, so they pass through exactly the same governance.

What's in the box ​

ComponentWhat it does
karhutlasql-serverThe Flight SQL server (DuckDB is linked in) plus an admin HTTP port for /healthz, /metrics, and admin endpoints; optional PostgreSQL (--pg-port), HTTP Arrow + Delta Sharing (--http-port), and MCP (--mcp-port) listeners
karhutlasql-clientA CLI with a REPL, scripts, CSV/JSON output, SSO login, report verification, and an MCP stdio bridge for AI agents
pkg/clientA Go library for building your own clients
Container image & Helm chartA distroless image (plus a lake variant with DuckDB extensions) and a chart for Kubernetes
Dev stacksDocker Compose files for Keycloak, Prometheus + Grafana, Unity Catalog, and a DuckLake (Postgres + MinIO)

Feature map ​

AreaFeaturesLearn more
ProtocolsArrow Flight SQL: queries, prepared statements, parameters, metadata, bulk ingest, GetSqlInfoClient
PostgreSQL wirepsql, Power BI/Npgsql, ODBC, pgx: simple & extended protocol, binary formats, cancel, TLSPostgreSQL protocol
HTTP APIPOST /api/v1/query → Arrow IPC stream for web apps and notebooks, CORSHTTP query API
Web UISQL editor, tables, sessions, history, and jobs in the browserWeb UI
Data sharingDelta Sharing server for regulators and partners, governed per recipient, signed download URLsDelta Sharing
IdentityLocal users (bcrypt), OIDC/JWKS (Keycloak, Entra ID, Okta), TLS & mTLS, allow-listsAuthentication
AuthorizationDefault-deny privileges per catalog/schema/table, role mapping from token claimsPolicy
Data protectionTag-based masking, row-level security, ai_sandbox profile, four-eyes policy changes, egress allow-list, PII auto-classificationPolicy
Workload controlResource groups & queues, timeouts, rate limits, per-team quotas, result cachePolicy
ObservabilityPrometheus metrics, OpenTelemetry tracing, query history, sessions & killMonitoring
ComplianceWORM access history, PII data-subject access, signed report runs, audit logReports
Data quality & catalogGreat Expectations gate, Unity Catalog OSS syncData quality · Catalog
AIMCP server (HTTP & stdio), verified queries, semantic model; vector similarity search with HNSW index (preview)MCP · Vector search
Scale-outDuckLake multi-writer, time travel, shared kill-sessionDuckLake
Other sourcesRead-only SQLite files as extra catalogs (preview)SQLite catalogs
AutomationCron-scheduled signed report runs and atomic materialized-table refreshes as job:<name> identitiesScheduled jobs
OperationsTiered backups, schema migrations, Vault Transit signing keysOperations

Typical deployments ​

Single node. One server with a .duckdb file on a persistent volume, TLS, OIDC, and a policy file. Enough for most departmental warehouses.

Workload classes on DuckLake. Several instances — for example an interactive instance for BI and a batch instance for reports — attached to the same DuckLake (catalog in Postgres, Parquet data in MinIO) and sharing one archive bucket. Memory and queues are separated per class; data, policy, and audit are shared.

Where to go next ​

  1. Quick start — run a server and your first query.
  2. Core concepts — the vocabulary used in the rest of the docs.
  3. Tutorials — sixteen step-by-step guides.

Released under the Apache 2.0 License.