semanticfed-sdk 2026.1031.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- semanticfed_sdk-2026.1031.1/.gitignore +172 -0
- semanticfed_sdk-2026.1031.1/CHANGELOG.md +49 -0
- semanticfed_sdk-2026.1031.1/LICENSE +9 -0
- semanticfed_sdk-2026.1031.1/PKG-INFO +269 -0
- semanticfed_sdk-2026.1031.1/README.md +209 -0
- semanticfed_sdk-2026.1031.1/docs/Makefile +20 -0
- semanticfed_sdk-2026.1031.1/docs/conf.py +57 -0
- semanticfed_sdk-2026.1031.1/docs/index.rst +18 -0
- semanticfed_sdk-2026.1031.1/examples/basic_usage.py +37 -0
- semanticfed_sdk-2026.1031.1/pyproject.toml +195 -0
- semanticfed_sdk-2026.1031.1/schema/README.md +26 -0
- semanticfed_sdk-2026.1031.1/src/semanticfed_sdk/__init__.py +332 -0
- semanticfed_sdk-2026.1031.1/src/semanticfed_sdk/py.typed +0 -0
- semanticfed_sdk-2026.1031.1/tests/__init__.py +1 -0
- semanticfed_sdk-2026.1031.1/tests/conftest.py +35 -0
- semanticfed_sdk-2026.1031.1/tests/test_graphql_documents.py +62 -0
- semanticfed_sdk-2026.1031.1/tests/test_modules.py +465 -0
- semanticfed_sdk-2026.1031.1/tests/test_smoke.py +191 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# poetry
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
102
|
+
#poetry.lock
|
|
103
|
+
|
|
104
|
+
# pdm
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
106
|
+
#pdm.lock
|
|
107
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
108
|
+
# in version control.
|
|
109
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
110
|
+
.pdm.toml
|
|
111
|
+
|
|
112
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
113
|
+
__pypackages__/
|
|
114
|
+
|
|
115
|
+
# Celery stuff
|
|
116
|
+
celerybeat-schedule
|
|
117
|
+
celerybeat.pid
|
|
118
|
+
|
|
119
|
+
# SageMath parsed files
|
|
120
|
+
*.sage.py
|
|
121
|
+
|
|
122
|
+
# Environments
|
|
123
|
+
.env
|
|
124
|
+
.venv
|
|
125
|
+
env/
|
|
126
|
+
venv/
|
|
127
|
+
ENV/
|
|
128
|
+
env.bak/
|
|
129
|
+
venv.bak/
|
|
130
|
+
|
|
131
|
+
# Spyder project settings
|
|
132
|
+
.spyderproject
|
|
133
|
+
.spyproject
|
|
134
|
+
|
|
135
|
+
# Rope project settings
|
|
136
|
+
.ropeproject
|
|
137
|
+
|
|
138
|
+
# mkdocs documentation
|
|
139
|
+
/site
|
|
140
|
+
|
|
141
|
+
# mypy
|
|
142
|
+
.mypy_cache/
|
|
143
|
+
.dmypy.json
|
|
144
|
+
dmypy.json
|
|
145
|
+
|
|
146
|
+
# Pyre type checker
|
|
147
|
+
.pyre/
|
|
148
|
+
|
|
149
|
+
# pytype static type analyzer
|
|
150
|
+
.pytype/
|
|
151
|
+
|
|
152
|
+
# Cython debug symbols
|
|
153
|
+
cython_debug/
|
|
154
|
+
|
|
155
|
+
# PyCharm
|
|
156
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
157
|
+
# be added to the global gitignore or merged into this project gitignore. For a PyCharm
|
|
158
|
+
# project, it is recommended to include the following directory since it contains user-specific
|
|
159
|
+
# configurations:
|
|
160
|
+
.idea/
|
|
161
|
+
|
|
162
|
+
# VSCode
|
|
163
|
+
.vscode/
|
|
164
|
+
|
|
165
|
+
# OS generated files
|
|
166
|
+
.DS_Store
|
|
167
|
+
.DS_Store?
|
|
168
|
+
._*
|
|
169
|
+
.Spotlight-V100
|
|
170
|
+
.Trashes
|
|
171
|
+
ehthumbs.db
|
|
172
|
+
Thumbs.db
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [CalVer](https://calver.org/) (`YYYY.MDD.PATCH`).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Changed (BOFF-4275)
|
|
11
|
+
- First public release on PyPI as `semanticfed-sdk`, through the shared G60
|
|
12
|
+
release workflow (`release.yml`): CalVer tag or dispatch, hash-locked build
|
|
13
|
+
from `uv.lock`, upload, wheel smoke import, git tag and GitHub Release.
|
|
14
|
+
- `__version__` comes from the installed distribution instead of a hard-coded
|
|
15
|
+
string, and is sent as the product version.
|
|
16
|
+
- Requires `burdenoff-sdk-libs` 2026.1029.1.
|
|
17
|
+
- The SDK presents the SemanticFed app Origin (`https://app.semanticfed.com`,
|
|
18
|
+
or `https://alphaapp.semanticfed.com` for the alpha gateway) so the workspace
|
|
19
|
+
gateway resolves product access and RBAC to SemanticFed. Override it with
|
|
20
|
+
`product_origin=` or `SEMANTICFED_ORIGIN`.
|
|
21
|
+
- `SEMANTICFED_MODULES`, `SEMANTICFED_PRODUCT_ORIGINS` and
|
|
22
|
+
`resolve_product_origin` are exported.
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
- `tests/test_graphql_documents.py` validates every SemanticFed GraphQL
|
|
26
|
+
document against the vendored production workspace supergraph
|
|
27
|
+
(`schema/wspace.graphql`); CI runs it as a named step together with mypy.
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
- Rewrote the SDK as a thin shell over `burdenoff-sdk-libs`. The hand-vendored
|
|
31
|
+
per-feature module tree (client, types, auth, user, workspace, rbac, team,
|
|
32
|
+
project, resources, billing, organization, payment, quota, store, support,
|
|
33
|
+
usage, utils, addon, plan, product) and its mock-based tests were removed.
|
|
34
|
+
- All module surfaces are now nested under their owning module. The Semanticfed
|
|
35
|
+
domain bundle is reached via `sdk.semanticfed.<entity>` (connectors,
|
|
36
|
+
data_sources, connections, models, entities, dimensions, metrics,
|
|
37
|
+
relationships, queries, query_runs, access_policies, health).
|
|
38
|
+
|
|
39
|
+
### Added
|
|
40
|
+
- `SemanticfedSDK` facade mounting 23 modules from `burdenoff-sdk-libs`: the
|
|
41
|
+
shared generic set plus the `semanticfed` domain module and the standalone
|
|
42
|
+
`sandbox` module.
|
|
43
|
+
- Shared-gateway defaults and the `burdenoff_cli_semanticfed` OIDC client id.
|
|
44
|
+
- `py.typed` marker shipped in the wheel; strict mypy in CI.
|
|
45
|
+
- Real-construction smoke tests (no mocks).
|
|
46
|
+
|
|
47
|
+
### Removed
|
|
48
|
+
- Vendored module directories under `src/semanticfed_sdk/` and the mock-based
|
|
49
|
+
unit tests.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Copyright (c) 2025 Burdenoff Consultancy Services Private Limited, Algoshred Technologies Private Limited and all sister companies.
|
|
2
|
+
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
This software is proprietary and confidential. Unauthorized copying, modification, distribution, or use of this software, via any medium, is strictly prohibited without the express written permission of the copyright holders.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
8
|
+
|
|
9
|
+
For licensing inquiries, please contact: legal@algoshred.com
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: semanticfed-sdk
|
|
3
|
+
Version: 2026.1031.1
|
|
4
|
+
Summary: Official Python SDK for SemanticFed, the federated semantic layer (thin shell over burdenoff-sdk-libs)
|
|
5
|
+
Project-URL: Homepage, https://semanticfed.com
|
|
6
|
+
Project-URL: Documentation, https://github.com/algoshred/semanticfed-sdk-python#readme
|
|
7
|
+
Project-URL: Repository, https://github.com/algoshred/semanticfed-sdk-python
|
|
8
|
+
Project-URL: Issues, https://github.com/algoshred/semanticfed-sdk-python/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/algoshred/semanticfed-sdk-python/blob/main/CHANGELOG.md
|
|
10
|
+
Author-email: "Vignesh T.V" <vignesh@algoshred.com>
|
|
11
|
+
Maintainer-email: "Vignesh T.V" <vignesh@algoshred.com>
|
|
12
|
+
License: Copyright (c) 2025 Burdenoff Consultancy Services Private Limited, Algoshred Technologies Private Limited and all sister companies.
|
|
13
|
+
|
|
14
|
+
All rights reserved.
|
|
15
|
+
|
|
16
|
+
This software is proprietary and confidential. Unauthorized copying, modification, distribution, or use of this software, via any medium, is strictly prohibited without the express written permission of the copyright holders.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
19
|
+
|
|
20
|
+
For licensing inquiries, please contact: legal@algoshred.com
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Keywords: api-client,burdenoff,graphql,python,sdk,semantic-layer,semanticfed
|
|
23
|
+
Classifier: Development Status :: 3 - Alpha
|
|
24
|
+
Classifier: Intended Audience :: Developers
|
|
25
|
+
Classifier: License :: Other/Proprietary License
|
|
26
|
+
Classifier: Operating System :: OS Independent
|
|
27
|
+
Classifier: Programming Language :: Python :: 3
|
|
28
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
29
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
30
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
31
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
32
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
|
|
33
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
34
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
35
|
+
Requires-Python: >=3.10
|
|
36
|
+
Requires-Dist: burdenoff-sdk-libs>=2026.1029.1
|
|
37
|
+
Requires-Dist: httpx>=0.24.0
|
|
38
|
+
Requires-Dist: typing-extensions>=4.0.0; python_version < '3.11'
|
|
39
|
+
Provides-Extra: dev
|
|
40
|
+
Requires-Dist: black>=23.0.0; extra == 'dev'
|
|
41
|
+
Requires-Dist: flake8>=6.0.0; extra == 'dev'
|
|
42
|
+
Requires-Dist: graphql-core>=3.2.0; extra == 'dev'
|
|
43
|
+
Requires-Dist: isort>=5.12.0; extra == 'dev'
|
|
44
|
+
Requires-Dist: mypy>=1.0.0; extra == 'dev'
|
|
45
|
+
Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
|
|
46
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
|
|
47
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
48
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
49
|
+
Requires-Dist: respx>=0.21.0; extra == 'dev'
|
|
50
|
+
Provides-Extra: docs
|
|
51
|
+
Requires-Dist: sphinx-autodoc-typehints>=1.19.0; extra == 'docs'
|
|
52
|
+
Requires-Dist: sphinx-rtd-theme>=1.2.0; extra == 'docs'
|
|
53
|
+
Requires-Dist: sphinx>=6.0.0; extra == 'docs'
|
|
54
|
+
Provides-Extra: test
|
|
55
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'test'
|
|
56
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'test'
|
|
57
|
+
Requires-Dist: pytest>=7.0.0; extra == 'test'
|
|
58
|
+
Requires-Dist: respx>=0.21.0; extra == 'test'
|
|
59
|
+
Description-Content-Type: text/markdown
|
|
60
|
+
|
|
61
|
+
# semanticfed-sdk
|
|
62
|
+
|
|
63
|
+
Official Python SDK for [SemanticFed](https://semanticfed.com), 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.
|
|
64
|
+
|
|
65
|
+
This SDK is a thin shell over [`burdenoff-sdk-libs`](https://pypi.org/project/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.
|
|
66
|
+
|
|
67
|
+
Node.js users: see [`@burdenoff/semanticfed-sdk`](https://www.npmjs.com/package/@burdenoff/semanticfed-sdk).
|
|
68
|
+
|
|
69
|
+
## Features
|
|
70
|
+
|
|
71
|
+
- Async/await throughout, built on `httpx`
|
|
72
|
+
- Workspace-token auth for pipelines, plus email/password, device code, PKCE and client credentials
|
|
73
|
+
- Automatic token refresh and a typed error hierarchy
|
|
74
|
+
- 23 mounted modules: the shared platform set, `semanticfed` and `sandbox`
|
|
75
|
+
- Full type hints with a `py.typed` marker; Python 3.10+
|
|
76
|
+
|
|
77
|
+
## Installation
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
pip install semanticfed-sdk
|
|
81
|
+
# or
|
|
82
|
+
uv add semanticfed-sdk
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Quick start
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
import asyncio
|
|
89
|
+
import os
|
|
90
|
+
|
|
91
|
+
from semanticfed_sdk import SemanticfedSDK
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
async def main() -> None:
|
|
95
|
+
# Production gateways are the default. A workspace-scoped token is all a
|
|
96
|
+
# pipeline needs; the access token is used to mint or refresh it.
|
|
97
|
+
sdk = SemanticfedSDK(
|
|
98
|
+
access_token=os.environ["SEMANTICFED_ACCESS_TOKEN"],
|
|
99
|
+
workspace_token=os.environ["SEMANTICFED_WORKSPACE_TOKEN"],
|
|
100
|
+
)
|
|
101
|
+
try:
|
|
102
|
+
connectors = await sdk.semanticfed.connectors.list()
|
|
103
|
+
models = await sdk.semanticfed.models.list(status="PUBLISHED")
|
|
104
|
+
print(len(connectors.items), "connectors,", len(models.items), "published models")
|
|
105
|
+
finally:
|
|
106
|
+
await sdk.close()
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
asyncio.run(main())
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Managing a semantic model
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from burdenoff_sdk_libs.modules.semanticfed.types import (
|
|
116
|
+
SemCreateConnectorInput,
|
|
117
|
+
SemCreateDataSourceInput,
|
|
118
|
+
SemCreateDimensionInput,
|
|
119
|
+
SemCreateEntityInput,
|
|
120
|
+
SemCreateMetricInput,
|
|
121
|
+
SemCreateModelInput,
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
s = sdk.semanticfed
|
|
125
|
+
connector = await s.connectors.create(SemCreateConnectorInput(name="Warehouse", kind="POSTGRES"))
|
|
126
|
+
source = await s.data_sources.create(
|
|
127
|
+
SemCreateDataSourceInput(connector_id=connector.id, name="analytics")
|
|
128
|
+
)
|
|
129
|
+
model = await s.models.create(SemCreateModelInput(name="Revenue", tags=["finance"]))
|
|
130
|
+
orders = await s.entities.create(
|
|
131
|
+
SemCreateEntityInput(
|
|
132
|
+
model_id=model.id,
|
|
133
|
+
name="orders",
|
|
134
|
+
kind="TABLE",
|
|
135
|
+
data_source_id=source.id,
|
|
136
|
+
physical_name="public.orders",
|
|
137
|
+
primary_key="id",
|
|
138
|
+
)
|
|
139
|
+
)
|
|
140
|
+
await s.dimensions.create(SemCreateDimensionInput(entity_id=orders.id, name="region", data_type="STRING"))
|
|
141
|
+
await s.metrics.create(
|
|
142
|
+
SemCreateMetricInput(entity_id=orders.id, name="gmv", aggregation="SUM", expression="amount")
|
|
143
|
+
)
|
|
144
|
+
await s.models.publish(model.id)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Running a governed query
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
from burdenoff_sdk_libs.modules.semanticfed.types import SemCreateQueryInput, SemPaginationInput
|
|
151
|
+
|
|
152
|
+
query = await s.queries.create(
|
|
153
|
+
SemCreateQueryInput(
|
|
154
|
+
name="GMV by region",
|
|
155
|
+
model_id=model.id,
|
|
156
|
+
query_text="SELECT region, gmv FROM orders",
|
|
157
|
+
cacheable=True,
|
|
158
|
+
cache_ttl_seconds=300,
|
|
159
|
+
)
|
|
160
|
+
)
|
|
161
|
+
await s.queries.publish(query.id)
|
|
162
|
+
|
|
163
|
+
run = await s.queries.run(query.id)
|
|
164
|
+
finished = await s.query_runs.get(run.id)
|
|
165
|
+
result = await s.query_runs.result(run.id, SemPaginationInput(limit=100))
|
|
166
|
+
print(finished.status if finished else None, [c.name for c in result.columns], result.rows)
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Access policies (`s.access_policies.list/create/set_active`) apply to every query the SDK runs, exactly as they do in the app.
|
|
170
|
+
|
|
171
|
+
## API surface
|
|
172
|
+
|
|
173
|
+
| Namespace | Operations |
|
|
174
|
+
|---|---|
|
|
175
|
+
| `connectors` | `get`, `list`, `create`, `update`, `archive` |
|
|
176
|
+
| `data_sources` | `get`, `list`, `create`, `update`, `archive`, `transition` |
|
|
177
|
+
| `connections` | `list`, `record` |
|
|
178
|
+
| `models` | `get`, `list`, `create`, `update`, `archive`, `publish` |
|
|
179
|
+
| `entities` | `get`, `list`, `create`, `update`, `delete` |
|
|
180
|
+
| `dimensions`, `metrics` | `create` |
|
|
181
|
+
| `relationships` | `list`, `create` |
|
|
182
|
+
| `queries` | `get`, `list`, `create`, `update`, `archive`, `publish`, `run` |
|
|
183
|
+
| `query_runs` | `get`, `list`, `result` |
|
|
184
|
+
| `access_policies` | `list`, `create`, `set_active` |
|
|
185
|
+
| `health` | `check` |
|
|
186
|
+
|
|
187
|
+
Every document the SDK sends is validated in CI against the production workspace supergraph (`tests/test_graphql_documents.py`).
|
|
188
|
+
|
|
189
|
+
## Modules
|
|
190
|
+
|
|
191
|
+
All methods are async. The following modules are mounted on the `SemanticfedSDK`
|
|
192
|
+
instance: `auth`, `billing`, `channels`, `conversations`, `devportal`,
|
|
193
|
+
`export`, `files`, `groups`, `health`, `integrations`, `semanticfed`,
|
|
194
|
+
`notifications`, `organizations`, `products`, `rbac`, `sandbox`, `scheduler`,
|
|
195
|
+
`security`, `store`, `support`, `tags`, `tours`, `workspaces`.
|
|
196
|
+
|
|
197
|
+
## Configuration
|
|
198
|
+
|
|
199
|
+
```python
|
|
200
|
+
from semanticfed_sdk import SemanticfedSDK
|
|
201
|
+
|
|
202
|
+
sdk = SemanticfedSDK(
|
|
203
|
+
workspace_endpoint=None, # SEMANTICFED_WORKSPACE_ENDPOINT, BURDENOFF_WORKSPACE_ENDPOINT, then prod
|
|
204
|
+
global_endpoint=None, # SEMANTICFED_GLOBAL_ENDPOINT, BURDENOFF_GLOBAL_ENDPOINT, then prod
|
|
205
|
+
product_origin=None, # SEMANTICFED_ORIGIN, then the app shell of a known gateway
|
|
206
|
+
client_id="burdenoff_cli_semanticfed", # default
|
|
207
|
+
oidc_issuer=None, # derived from global_endpoint
|
|
208
|
+
api_key=None,
|
|
209
|
+
access_token=None,
|
|
210
|
+
refresh_token=None,
|
|
211
|
+
workspace_token=None,
|
|
212
|
+
timeout=30.0,
|
|
213
|
+
auto_refresh=True,
|
|
214
|
+
)
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Error Handling
|
|
218
|
+
|
|
219
|
+
```python
|
|
220
|
+
from semanticfed_sdk import (
|
|
221
|
+
SemanticfedError,
|
|
222
|
+
AuthenticationError,
|
|
223
|
+
AuthorizationError,
|
|
224
|
+
NetworkError,
|
|
225
|
+
ValidationError,
|
|
226
|
+
RateLimitError,
|
|
227
|
+
DeviceCodeExpiredError,
|
|
228
|
+
DeviceCodeDeniedError,
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
try:
|
|
232
|
+
await sdk.auth.sign_in(email="user@example.com", password="wrong")
|
|
233
|
+
except AuthenticationError:
|
|
234
|
+
print("Invalid credentials")
|
|
235
|
+
except NetworkError:
|
|
236
|
+
print("Could not reach the API")
|
|
237
|
+
except SemanticfedError as e:
|
|
238
|
+
print(f"SDK error: {e}")
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Development
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
python -m venv .venv && source .venv/bin/activate
|
|
245
|
+
pip install -e ".[dev]"
|
|
246
|
+
|
|
247
|
+
make format # black + isort
|
|
248
|
+
make lint # flake8
|
|
249
|
+
make type-check # mypy (strict)
|
|
250
|
+
make test # pytest
|
|
251
|
+
make sanity # format-check + lint + type-check + test (cov>=80) + build
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
The release install is hash-locked: `uv sync --locked --all-extras` reproduces it.
|
|
255
|
+
|
|
256
|
+
## Releasing
|
|
257
|
+
|
|
258
|
+
Releases are cut from `main` by `.github/workflows/release.yml` (shared G60
|
|
259
|
+
workflow): push a CalVer tag (`2026.1031.1`) or dispatch the workflow with an
|
|
260
|
+
empty version. The run gates and builds from `uv.lock`, uploads to PyPI,
|
|
261
|
+
smoke-imports the published wheel and creates the git tag and GitHub Release.
|
|
262
|
+
|
|
263
|
+
## License
|
|
264
|
+
|
|
265
|
+
Proprietary — Copyright Burdenoff Consultancy Services Pvt. Ltd.
|
|
266
|
+
|
|
267
|
+
## Support
|
|
268
|
+
|
|
269
|
+
- Issues: [GitHub Issues](https://github.com/algoshred/semanticfed-sdk-python/issues)
|