Skip to main content

Run a chDB (in-process ClickHouse) analyst on serverless — one app and image across AWS Lambda, Cloud Run, and Azure Container Apps, with a store seam that carries it to durable and memory tiers.

Project description

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 seamlocal: (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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chdb_serverless-0.1.0.tar.gz (24.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chdb_serverless-0.1.0-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file chdb_serverless-0.1.0.tar.gz.

File metadata

  • Download URL: chdb_serverless-0.1.0.tar.gz
  • Upload date:
  • Size: 24.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for chdb_serverless-0.1.0.tar.gz
Algorithm Hash digest
SHA256 19b242a01ef59a3d58f029da3ab1dbc6ac46f03f64a22202ca941ab2f9f83a8b
MD5 8e64ffcdec0df3c09479d96b8c64a491
BLAKE2b-256 a5d8a185af71e802a49e7abb1c99f9b416968ffb95291189d34d6e700489e23b

See more details on using hashes here.

File details

Details for the file chdb_serverless-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for chdb_serverless-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 116ac850dc8e41ebe28ec47c06241b07b90834f02cef1a94817afcbef4166378
MD5 c1570ae9d1493d65fa638128df43bb14
BLAKE2b-256 fe6fa730eab88bb5a8754c025c045c89f902a225b4a1161b8cc36450c40066a2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page