sqlproxy

package
v0.3.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package sqlproxy serves GET/POST /v0/sql — a read-only ClickHouse SQL proxy. It does NOT parse SQL to enforce read-only; it forwards the query with a readonly profile + resource caps and lets ClickHouse refuse writes/DDL structurally (ADR 0011). Errors map to the shared Tinybird envelope, passing the ClickHouse exception code through X-DB-Exception-Code (ADR 0012).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(q model.CHQuerier, opts ...Option) http.Handler

New returns the /v0/sql handler. q runs the query over ClickHouse HTTP.

ponytail: MVP enforces read-only by sending readonly=2 as a per-query setting. Production should point q at a dedicated CH user whose profile pins readonly=2 server-side, so a settings injection in the query text can't unset it (ADR 0011 — "two ClickHouse identities").

Types

type Option

type Option func(*handler)

Option configures the handler.

func WithSettings

func WithSettings(s map[string]string) Option

WithSettings overlays caller settings onto the readonly + caps defaults.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL