Skip to main content

chdb-serverless

Run a chDB (in-process ClickHouse) analyst on serverless — one app and one image across AWS Lambda, Google Cloud Run, and Azure Container Apps, with two plug seams that keep the core unchanged as you grow:

  • store seam — local: (this package, L1) → durable: (S3-backed object, L2) → memory: (analytical agent memory, L3), chosen by CHDB_STORE;
  • model seam — Anthropic / OpenAI / any OpenAI-compatible server, chosen by CHDB_MODEL, so the analyst is not anchored to one LLM.

This repo is the base. The walkthroughs — why in-process, the cold-start comparison across clouds, the tier ladder — live in the chDB cookbook serverless series. Heritage: this repo pioneered chDB-on-Lambda in 2023 (thanks @lmangani); the maintained, multi-cloud version is here.

Use as a template (clone and deploy)

git clone https://github.com/chdb-io/chdb-lambda
cd chdb-lambda
export ANTHROPIC_API_KEY=sk-...        # optional — omit for /query only
deploy/aws-lambda/deploy.sh            # or gcp-cloud-run/ or azure-container-apps/

Auth posture (read before deploying): /query runs caller-supplied ClickHouse SQL and /ask spends model tokens, so every lane deploys non-public by default — AWS Lambda uses an AWS_IAM Function URL, and Cloud Run / Container Apps use private ingress. Set PUBLIC=1 to opt into an unauthenticated endpoint for a throwaway demo, and put your own auth in front before exposing anything real.

Use as a package (import, don't copy)

pip install chdb-serverless[anthropic]   # or [openai]
from chdb_serverless import analyst_app, open_store
app = analyst_app()          # FastAPI: /health /query /ask
store = open_store()         # CHDB_STORE selects the tier

Seams

Env Values Meaning
CHDB_STORE local:/path · durable:s3://… · memory:s3://… which tier (L1 now; L2/L3 via extras)
CHDB_MODEL anthropic:claude-opus-4-8 · openai:gpt-4.1 · openai:llama3@http://host/v1 which LLM (any OpenAI-compatible server via @base_url)

Extras: [anthropic] [openai] (LLM providers), [durable] (L2), [memory] (L3).

Layout

src/chdb_serverless/   app: server.py (/health /query /ask), agent.py, store.py, models/
Dockerfile             one image; bakes the dataset; carries the Lambda Web Adapter (inert off Lambda)
deploy/                per-cloud deploy.sh + teardown.sh (aws-lambda / gcp-cloud-run / azure-container-apps)

Metadata

Release files for chdb-serverless 0.1.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 chdb-serverless 0.1.0
File Size Uploaded
chdb_serverless-0.1.0.tar.gz 24.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chdb-serverless 0.1.0
File Interpreter ABI Platform
chdb_serverless-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 43.0 kB

Release files / chdb_serverless-0.1.0.tar.gz

Download URL chdb_serverless-0.1.0.tar.gz
Size 24.1 kB
Tags Source
SHA-256 checksum
How to use checksums
19b242a01ef59a3d58f029da3ab1dbc6ac46f03f64a22202ca941ab2f9f83a8b
BLAKE2b-256 checksum
How to use checksums
a5d8a185af71e802a49e7abb1c99f9b416968ffb95291189d34d6e700489e23b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release files / chdb_serverless-0.1.0-py3-none-any.whl

Download URL chdb_serverless-0.1.0-py3-none-any.whl
Size 18.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
116ac850dc8e41ebe28ec47c06241b07b90834f02cef1a94817afcbef4166378
BLAKE2b-256 checksum
How to use checksums
fe6fa730eab88bb5a8754c025c045c89f902a225b4a1161b8cc36450c40066a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release history Release notifications | RSS feed

This release

0.1.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