Adding FastAPI server as boring-semantic-layer[server]#212
Open
radders1981 wants to merge 1 commit intoboringdata:mainfrom
Open
Adding FastAPI server as boring-semantic-layer[server]#212radders1981 wants to merge 1 commit intoboringdata:mainfrom
radders1981 wants to merge 1 commit intoboringdata:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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