semanticfed-sdk
Official Python SDK for SemanticFed, the federated semantic layer. It gives scripts, notebooks, CI/CD jobs and data pipelines async, typed access to connectors, data sources, semantic models, entities, dimensions, metrics, relationships, governed queries and access policies.
This SDK is a thin shell over burdenoff-sdk-libs. It talks to the Burdenoff production gateways by default and presents the SemanticFed app Origin, so product access and RBAC resolve to SemanticFed for every call.
Node.js users: see @burdenoff/semanticfed-sdk.
Features
- Async/await throughout, built on
httpx - Workspace-token auth for pipelines, plus email/password, device code, PKCE and client credentials
- Automatic token refresh and a typed error hierarchy
- 23 mounted modules: the shared platform set,
semanticfedandsandbox - Full type hints with a
py.typedmarker; Python 3.10+
Installation
pip install semanticfed-sdk
# or
uv add semanticfed-sdk
Quick start
import asyncio
import os
from semanticfed_sdk import SemanticfedSDK
async def main() -> None:
# Production gateways are the default. A workspace-scoped token is all a
# pipeline needs; the access token is used to mint or refresh it.
sdk = SemanticfedSDK(
access_token=os.environ["SEMANTICFED_ACCESS_TOKEN"],
workspace_token=os.environ["SEMANTICFED_WORKSPACE_TOKEN"],
)
try:
connectors = await sdk.semanticfed.connectors.list()
models = await sdk.semanticfed.models.list(status="PUBLISHED")
print(len(connectors.items), "connectors,", len(models.items), "published models")
finally:
await sdk.close()
asyncio.run(main())
Managing a semantic model
from burdenoff_sdk_libs.modules.semanticfed.types import (
SemCreateConnectorInput,
SemCreateDataSourceInput,
SemCreateDimensionInput,
SemCreateEntityInput,
SemCreateMetricInput,
SemCreateModelInput,
)
s = sdk.semanticfed
connector = await s.connectors.create(SemCreateConnectorInput(name="Warehouse", kind="POSTGRES"))
source = await s.data_sources.create(
SemCreateDataSourceInput(connector_id=connector.id, name="analytics")
)
model = await s.models.create(SemCreateModelInput(name="Revenue", tags=["finance"]))
orders = await s.entities.create(
SemCreateEntityInput(
model_id=model.id,
name="orders",
kind="TABLE",
data_source_id=source.id,
physical_name="public.orders",
primary_key="id",
)
)
await s.dimensions.create(SemCreateDimensionInput(entity_id=orders.id, name="region", data_type="STRING"))
await s.metrics.create(
SemCreateMetricInput(entity_id=orders.id, name="gmv", aggregation="SUM", expression="amount")
)
await s.models.publish(model.id)
Running a governed query
from burdenoff_sdk_libs.modules.semanticfed.types import SemCreateQueryInput, SemPaginationInput
query = await s.queries.create(
SemCreateQueryInput(
name="GMV by region",
model_id=model.id,
query_text="SELECT region, gmv FROM orders",
cacheable=True,
cache_ttl_seconds=300,
)
)
await s.queries.publish(query.id)
run = await s.queries.run(query.id)
finished = await s.query_runs.get(run.id)
result = await s.query_runs.result(run.id, SemPaginationInput(limit=100))
print(finished.status if finished else None, [c.name for c in result.columns], result.rows)
Access policies (s.access_policies.list/create/set_active) apply to every query the SDK runs, exactly as they do in the app.
API surface
| Namespace | Operations |
|---|---|
connectors |
get, list, create, update, archive |
data_sources |
get, list, create, update, archive, transition |
connections |
list, record |
models |
get, list, create, update, archive, publish |
entities |
get, list, create, update, delete |
dimensions, metrics |
create |
relationships |
list, create |
queries |
get, list, create, update, archive, publish, run |
query_runs |
get, list, result |
access_policies |
list, create, set_active |
health |
check |
Every document the SDK sends is validated in CI against the production workspace supergraph (tests/test_graphql_documents.py).
Modules
All methods are async. The following modules are mounted on the SemanticfedSDK
instance: auth, billing, channels, conversations, devportal,
export, files, groups, health, integrations, semanticfed,
notifications, organizations, products, rbac, sandbox, scheduler,
security, store, support, tags, tours, workspaces.
Configuration
from semanticfed_sdk import SemanticfedSDK
sdk = SemanticfedSDK(
workspace_endpoint=None, # SEMANTICFED_WORKSPACE_ENDPOINT, BURDENOFF_WORKSPACE_ENDPOINT, then prod
global_endpoint=None, # SEMANTICFED_GLOBAL_ENDPOINT, BURDENOFF_GLOBAL_ENDPOINT, then prod
product_origin=None, # SEMANTICFED_ORIGIN, then the app shell of a known gateway
client_id="burdenoff_cli_semanticfed", # default
oidc_issuer=None, # derived from global_endpoint
api_key=None,
access_token=None,
refresh_token=None,
workspace_token=None,
timeout=30.0,
auto_refresh=True,
)
Error Handling
from semanticfed_sdk import (
SemanticfedError,
AuthenticationError,
AuthorizationError,
NetworkError,
ValidationError,
RateLimitError,
DeviceCodeExpiredError,
DeviceCodeDeniedError,
)
try:
await sdk.auth.sign_in(email="user@example.com", password="wrong")
except AuthenticationError:
print("Invalid credentials")
except NetworkError:
print("Could not reach the API")
except SemanticfedError as e:
print(f"SDK error: {e}")
Development
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
make format # black + isort
make lint # flake8
make type-check # mypy (strict)
make test # pytest
make sanity # format-check + lint + type-check + test (cov>=80) + build
The release install is hash-locked: uv sync --locked --all-extras reproduces it.
Releasing
Releases are cut from main by .github/workflows/release.yml (shared G60
workflow): push a CalVer tag (2026.1031.1) or dispatch the workflow with an
empty version. The run gates and builds from uv.lock, uploads to PyPI,
smoke-imports the published wheel and creates the git tag and GitHub Release.
License
Proprietary — Copyright Burdenoff Consultancy Services Pvt. Ltd.
Support
- Issues: GitHub Issues
Metadata
Release files for semanticfed-sdk 2026.1107.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| semanticfed_sdk-2026.1107.1.tar.gz | 19.4 kB | Without provenance | Details for semanticfed_sdk-2026.1107.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| semanticfed_sdk-2026.1107.1-py3-none-any.whl | Python 3 | none | any | Details for semanticfed_sdk-2026.1107.1-py3-none-any.whl |
Total release size: 29.5 kB
Release files / semanticfed_sdk-2026.1107.1.tar.gz
| Download URL | semanticfed_sdk-2026.1107.1.tar.gz |
|---|---|
| Size | 19.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e6fa5be3ea7243c4be94a7a409cfc41e1f28839fd5c60df3a7402568919aaf2
|
|
BLAKE2b-256 checksum How to use checksums |
d381112e16bedf21de64ec23b75dcb6583b60e9402662741758a30f3b755feec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / semanticfed_sdk-2026.1107.1-py3-none-any.whl
| Download URL | semanticfed_sdk-2026.1107.1-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
abe3cca35d84c85202db5810dd845ed1610fd79ce767e86403278ba26bf0af19
|
|
BLAKE2b-256 checksum How to use checksums |
ad74941df13292e7245dfdc2733b49e955fe02f6f130600e80e0c49e007e09d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for semanticfed-sdk 2026.1107.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.