Skip to content

Adding FastAPI server as boring-semantic-layer[server]#212

Open
radders1981 wants to merge 1 commit intoboringdata:mainfrom
radders1981:main
Open

Adding FastAPI server as boring-semantic-layer[server]#212
radders1981 wants to merge 1 commit intoboringdata:mainfrom
radders1981:main

Conversation

@radders1981
Copy link

This PR introduces an optional HTTP API server that exposes BSL semantic models over REST, making it easy to query them from any language or tool without a Python runtime.

Summary
New server optional dependency — adds fastapi and uvicorn as an opt-in extra (pip install 'boring-semantic-layer[server]')
bsl serve CLI command — starts the FastAPI server, accepting --config, --host, --port, and --reload flags; config path falls back to BSL_CONFIG_PATH env var or ./semantic_config.py
Three REST endpoints:
GET /health — liveness check
GET /models / GET /models/{name}/schema — introspect available models and their dimensions/measures
POST /query — run queries with dimensions, measures, filters (eq/neq/gt/gte/lt/lte/contains), sorting, time-grain truncation (year/quarter/month/date), and limit
Dynamic config loader (server/loader.py) — imports semantic_config.py at startup via importlib, no hardcoded imports required
Example server config (examples/server/) — demo Duck DB generator and a sample semantic_config.py with full README

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.

1 participant