cosmos-semantic 0.1.0__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.
- cosmos_semantic-0.1.0/.gitattributes +1 -0
- cosmos_semantic-0.1.0/.github/workflows/ci.yml +44 -0
- cosmos_semantic-0.1.0/.github/workflows/release.yml +73 -0
- cosmos_semantic-0.1.0/.gitignore +12 -0
- cosmos_semantic-0.1.0/CHANGELOG.md +67 -0
- cosmos_semantic-0.1.0/CONTRIBUTING.md +40 -0
- cosmos_semantic-0.1.0/LICENSE +202 -0
- cosmos_semantic-0.1.0/NOTICE +9 -0
- cosmos_semantic-0.1.0/PKG-INFO +238 -0
- cosmos_semantic-0.1.0/README.md +186 -0
- cosmos_semantic-0.1.0/SECURITY.md +25 -0
- cosmos_semantic-0.1.0/deploy/docker-compose.yml +31 -0
- cosmos_semantic-0.1.0/docs/architecture.md +254 -0
- cosmos_semantic-0.1.0/docs/decisions/0001-cube-core-distribution.md +54 -0
- cosmos_semantic-0.1.0/docs/decisions/0002-dbt-inspired-authoring-format.md +28 -0
- cosmos_semantic-0.1.0/docs/decisions/0003-ossie-as-interchange-format.md +18 -0
- cosmos_semantic-0.1.0/docs/decisions/0004-own-semantic-engine.md +52 -0
- cosmos_semantic-0.1.0/docs/decisions/0005-open-core.md +37 -0
- cosmos_semantic-0.1.0/docs/decisions/0006-ontology-in-the-mvp.md +39 -0
- cosmos_semantic-0.1.0/docs/decisions/0007-connectors-sources-identity-and-import.md +55 -0
- cosmos_semantic-0.1.0/docs/decisions/0008-verifiable-numbers-as-phase-2-differentiator.md +52 -0
- cosmos_semantic-0.1.0/docs/decisions/0009-business-context-as-phase-3-differentiator.md +45 -0
- cosmos_semantic-0.1.0/docs/interoperability.md +111 -0
- cosmos_semantic-0.1.0/docs/product-vision.md +69 -0
- cosmos_semantic-0.1.0/docs/quickstart.md +102 -0
- cosmos_semantic-0.1.0/docs/roadmap.md +95 -0
- cosmos_semantic-0.1.0/docs/semantic-model.md +448 -0
- cosmos_semantic-0.1.0/examples/ecommerce/connections.yml +29 -0
- cosmos_semantic-0.1.0/examples/ecommerce/divergence_zoo.yml +142 -0
- cosmos_semantic-0.1.0/examples/ecommerce/semantic/context.yml +47 -0
- cosmos_semantic-0.1.0/examples/ecommerce/semantic/master_data.yml +75 -0
- cosmos_semantic-0.1.0/examples/ecommerce/semantic/ontology.yml +116 -0
- cosmos_semantic-0.1.0/examples/ecommerce/semantic/sales.yml +154 -0
- cosmos_semantic-0.1.0/pyproject.toml +89 -0
- cosmos_semantic-0.1.0/reference/queries.yml +344 -0
- cosmos_semantic-0.1.0/reference/queries_advanced.yml +492 -0
- cosmos_semantic-0.1.0/schema/cosmos-semantic.v1.schema.json +1350 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/__init__.py +0 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/api.py +217 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/auth.py +151 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/bootstrap.py +388 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/catalog.py +294 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/cli.py +1047 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/compiler.py +353 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/connectors.py +373 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/demo_data.py +351 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/discovery.py +487 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/engine.py +74 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/errors.py +18 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/evidence.py +331 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/expressions.py +193 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/impact.py +367 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/interchange/__init__.py +61 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/interchange/cube.py +333 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/interchange/dbt.py +385 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/interchange/ossie.py +264 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/interchange/powerbi.py +925 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/interchange/skos.py +280 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/knowledge.py +244 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/loader.py +65 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/mcp_server.py +137 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/ontology.py +332 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/packs/__init__.py +404 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/packs/retail/pack.yml +62 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/packs/retail/semantic/master_data.yml +75 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/packs/retail/semantic/ontology.yml +116 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/packs/retail/semantic/sales.yml +154 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/planner.py +723 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/reconcile.py +614 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/reference.py +163 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/service.py +215 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/spec.py +313 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/starter.py +81 -0
- cosmos_semantic-0.1.0/src/cosmos_semantic/usage.py +171 -0
- cosmos_semantic-0.1.0/tests/__init__.py +0 -0
- cosmos_semantic-0.1.0/tests/conftest.py +85 -0
- cosmos_semantic-0.1.0/tests/fixtures/cube/ecommerce.yml +95 -0
- cosmos_semantic-0.1.0/tests/fixtures/dbt_latest/models.yml +82 -0
- cosmos_semantic-0.1.0/tests/fixtures/dbt_legacy/semantic_models.yml +91 -0
- cosmos_semantic-0.1.0/tests/fixtures/ossie/ecommerce.yaml +98 -0
- cosmos_semantic-0.1.0/tests/fixtures/powerbi/ecommerce.bim +152 -0
- cosmos_semantic-0.1.0/tests/fixtures/powerbi_tmdl/definition/model.tmdl +11 -0
- cosmos_semantic-0.1.0/tests/fixtures/powerbi_tmdl/definition/relationships.tmdl +21 -0
- cosmos_semantic-0.1.0/tests/fixtures/powerbi_tmdl/definition/roles/Regional managers.tmdl +4 -0
- cosmos_semantic-0.1.0/tests/fixtures/powerbi_tmdl/definition/tables/Customers.tmdl +38 -0
- cosmos_semantic-0.1.0/tests/fixtures/powerbi_tmdl/definition/tables/Order Items.tmdl +39 -0
- cosmos_semantic-0.1.0/tests/fixtures/powerbi_tmdl/definition/tables/Orders.tmdl +76 -0
- cosmos_semantic-0.1.0/tests/fixtures/powerbi_tmdl/definition/tables/Payments.tmdl +29 -0
- cosmos_semantic-0.1.0/tests/fixtures/powerbi_tmdl/definition/tables/Products.tmdl +16 -0
- cosmos_semantic-0.1.0/tests/fixtures/powerbi_tmdl/definition/tables/Sellers.tmdl +16 -0
- cosmos_semantic-0.1.0/tests/fixtures/powerbi_tmdl/definition/tables/Top Products.tmdl +8 -0
- cosmos_semantic-0.1.0/tests/test_api.py +128 -0
- cosmos_semantic-0.1.0/tests/test_bootstrap.py +145 -0
- cosmos_semantic-0.1.0/tests/test_cross_db.py +162 -0
- cosmos_semantic-0.1.0/tests/test_discovery.py +225 -0
- cosmos_semantic-0.1.0/tests/test_engine.py +194 -0
- cosmos_semantic-0.1.0/tests/test_evidence.py +143 -0
- cosmos_semantic-0.1.0/tests/test_impact.py +120 -0
- cosmos_semantic-0.1.0/tests/test_interchange.py +176 -0
- cosmos_semantic-0.1.0/tests/test_knowledge.py +115 -0
- cosmos_semantic-0.1.0/tests/test_mcp.py +76 -0
- cosmos_semantic-0.1.0/tests/test_mcp_oauth.py +133 -0
- cosmos_semantic-0.1.0/tests/test_ontology.py +143 -0
- cosmos_semantic-0.1.0/tests/test_packs.py +214 -0
- cosmos_semantic-0.1.0/tests/test_powerbi.py +197 -0
- cosmos_semantic-0.1.0/tests/test_reconcile.py +92 -0
- cosmos_semantic-0.1.0/tests/test_reference.py +48 -0
- cosmos_semantic-0.1.0/tests/test_rule_versions.py +169 -0
- cosmos_semantic-0.1.0/tests/test_skos.py +98 -0
- cosmos_semantic-0.1.0/tests/test_starter.py +50 -0
- cosmos_semantic-0.1.0/tests/test_usage.py +108 -0
- cosmos_semantic-0.1.0/uv.lock +2251 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* text=auto eol=lf
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
services:
|
|
12
|
+
postgres:
|
|
13
|
+
image: postgres:16
|
|
14
|
+
env:
|
|
15
|
+
POSTGRES_USER: cosmos
|
|
16
|
+
POSTGRES_PASSWORD: cosmos
|
|
17
|
+
POSTGRES_DB: cosmos
|
|
18
|
+
ports: ["5432:5432"]
|
|
19
|
+
options: >-
|
|
20
|
+
--health-cmd "pg_isready -U cosmos" --health-interval 2s --health-retries 30
|
|
21
|
+
sqlserver:
|
|
22
|
+
image: mcr.microsoft.com/mssql/server:2022-latest
|
|
23
|
+
env:
|
|
24
|
+
ACCEPT_EULA: "Y"
|
|
25
|
+
MSSQL_SA_PASSWORD: "Cosmos!Passw0rd"
|
|
26
|
+
ports: ["1433:1433"]
|
|
27
|
+
env:
|
|
28
|
+
COSMOS_PG_URI: postgresql://cosmos:cosmos@localhost:5432/cosmos
|
|
29
|
+
COSMOS_MSSQL_URI: mssql+pymssql://sa:Cosmos!Passw0rd@localhost:1433/master
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@v4
|
|
32
|
+
- uses: astral-sh/setup-uv@v6
|
|
33
|
+
- run: uv sync --all-extras
|
|
34
|
+
- run: uv run ruff check src tests
|
|
35
|
+
- run: uv run ruff format --check src tests
|
|
36
|
+
- run: uv run cosmos validate -m examples/ecommerce/semantic
|
|
37
|
+
- run: uv run cosmos test -m examples/ecommerce/semantic
|
|
38
|
+
- name: Wait for SQL Server
|
|
39
|
+
run: |
|
|
40
|
+
for i in $(seq 1 60); do
|
|
41
|
+
uv run python -c "import pymssql; pymssql.connect('localhost', 'sa', 'Cosmos!Passw0rd', port=1433)" && break
|
|
42
|
+
sleep 2
|
|
43
|
+
done
|
|
44
|
+
- run: uv run pytest -q
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
# Pushing a tag `vX.Y.Z` builds the package, checks it, publishes it to PyPI through Trusted
|
|
4
|
+
# Publishing (no stored token: PyPI trusts this workflow and the `pypi` environment) and creates
|
|
5
|
+
# the GitHub release with the matching CHANGELOG section as notes.
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
tags: ["v*"]
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: astral-sh/setup-uv@v6
|
|
17
|
+
- name: Tag matches the package version
|
|
18
|
+
run: |
|
|
19
|
+
version=$(uv run --no-project python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
|
|
20
|
+
test "v$version" = "$GITHUB_REF_NAME" || { echo "tag $GITHUB_REF_NAME != version $version"; exit 1; }
|
|
21
|
+
grep -q "^## \[$version\]" CHANGELOG.md || { echo "CHANGELOG.md has no [$version] section"; exit 1; }
|
|
22
|
+
- run: uv sync --all-extras
|
|
23
|
+
- run: uv run ruff check src tests
|
|
24
|
+
- run: uv run pytest -q
|
|
25
|
+
- run: uv build
|
|
26
|
+
- run: uvx twine check --strict dist/*
|
|
27
|
+
- name: The wheel installs and runs the quickstart
|
|
28
|
+
run: |
|
|
29
|
+
python -m venv /tmp/qs && /tmp/qs/bin/pip install -q "$(ls dist/*.whl)[duckdb,testdata]"
|
|
30
|
+
cd "$(mktemp -d)"
|
|
31
|
+
/tmp/qs/bin/cosmos init demo && cd demo
|
|
32
|
+
/tmp/qs/bin/cosmos demo-data
|
|
33
|
+
/tmp/qs/bin/cosmos query revenue average_order_value --by orders.status --evidence
|
|
34
|
+
/tmp/qs/bin/cosmos explain rule:active_customer
|
|
35
|
+
- uses: actions/upload-artifact@v4
|
|
36
|
+
with:
|
|
37
|
+
name: dist
|
|
38
|
+
path: dist/
|
|
39
|
+
|
|
40
|
+
publish:
|
|
41
|
+
needs: build
|
|
42
|
+
runs-on: ubuntu-latest
|
|
43
|
+
environment:
|
|
44
|
+
name: pypi
|
|
45
|
+
url: https://pypi.org/project/cosmos-semantic/
|
|
46
|
+
permissions:
|
|
47
|
+
id-token: write
|
|
48
|
+
steps:
|
|
49
|
+
- uses: actions/download-artifact@v4
|
|
50
|
+
with:
|
|
51
|
+
name: dist
|
|
52
|
+
path: dist/
|
|
53
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
54
|
+
|
|
55
|
+
github-release:
|
|
56
|
+
needs: publish
|
|
57
|
+
runs-on: ubuntu-latest
|
|
58
|
+
permissions:
|
|
59
|
+
contents: write
|
|
60
|
+
steps:
|
|
61
|
+
- uses: actions/checkout@v4
|
|
62
|
+
- uses: actions/download-artifact@v4
|
|
63
|
+
with:
|
|
64
|
+
name: dist
|
|
65
|
+
path: dist/
|
|
66
|
+
- name: Release notes from CHANGELOG.md
|
|
67
|
+
run: |
|
|
68
|
+
version="${GITHUB_REF_NAME#v}"
|
|
69
|
+
awk -v h="## [$version]" 'index($0, h) == 1 {on=1; next} /^## \[/ {on=0} on' CHANGELOG.md > notes.md
|
|
70
|
+
test -s notes.md
|
|
71
|
+
- run: gh release create "$GITHUB_REF_NAME" dist/* --title "Cosmos Semantic $GITHUB_REF_NAME" --notes-file notes.md
|
|
72
|
+
env:
|
|
73
|
+
GH_TOKEN: ${{ github.token }}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are recorded here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow
|
|
5
|
+
[Semantic Versioning](https://semver.org/). Before 1.0, a minor version may change the authoring
|
|
6
|
+
format or the API; such changes are listed under **Changed**.
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-11-04
|
|
9
|
+
|
|
10
|
+
First public release. The whole test suite passes on DuckDB, Postgres, SQL Server and Databricks,
|
|
11
|
+
and on the lowest dependency versions this release allows.
|
|
12
|
+
|
|
13
|
+
### Engine and authoring format
|
|
14
|
+
|
|
15
|
+
- Own YAML authoring format with the dbt Semantic Layer vocabulary, `version: 1` and a JSON Schema
|
|
16
|
+
(`cosmos schema`); `cosmos validate` checks references, entities, join paths and row filters.
|
|
17
|
+
- Planner with one aggregation per measure-owner model and many-to-one joins inferred from
|
|
18
|
+
entities, so measures at different grains never multiply rows; one-to-many dimensions through a
|
|
19
|
+
distinct bridge.
|
|
20
|
+
- Metric types `simple`, `ratio`, `derived` and `cumulative`; NULL-safe division; integer averages
|
|
21
|
+
and divisions computed the same way on every database.
|
|
22
|
+
- "Today" pinned to the model's time zone or to the request's `as_of`, identically on every
|
|
23
|
+
database.
|
|
24
|
+
- Connectors that return Arrow: DuckDB, Postgres (ADBC), SQL Server (SQLAlchemy) and Databricks
|
|
25
|
+
(SQL warehouse, token or CLI profile).
|
|
26
|
+
|
|
27
|
+
### Ontology and security
|
|
28
|
+
|
|
29
|
+
- SKOS-style glossary with labels and synonyms per language, and business rules (`predicate`,
|
|
30
|
+
`classification` with a decision table, `derived`) with owner, effective date and tests
|
|
31
|
+
(`cosmos test`).
|
|
32
|
+
- Rule versions: a rule keeps its history, and a query uses the version in effect on its
|
|
33
|
+
`rules_as_of` date.
|
|
34
|
+
- Row filters from the user context (`$user`), OIDC identity (Entra ID first) with claims mapped
|
|
35
|
+
to the user context, and personal or sensitive data (`sensitivity`) never reaching AI agents.
|
|
36
|
+
|
|
37
|
+
### Verifiable numbers
|
|
38
|
+
|
|
39
|
+
- Evidence envelope on every answer (expanded formulas, rules with owner and test status, policies,
|
|
40
|
+
data source, `as_of`, model, SQL and result hashes) and `cosmos replay` from the audit log.
|
|
41
|
+
- `cosmos reconcile`: a governed metric against legacy SQL or another model, with a diagnosis of
|
|
42
|
+
the likely cause, proven against a "divergence zoo" of ten classic mistakes.
|
|
43
|
+
- `cosmos impact`: what a change to a rule, metric, measure, dimension, model, system or process
|
|
44
|
+
affects, who owns it and who queried it; `--changes-from` for pull requests.
|
|
45
|
+
- `cosmos bootstrap`: a draft model from the database catalog, without AI.
|
|
46
|
+
|
|
47
|
+
### Business context
|
|
48
|
+
|
|
49
|
+
- Teams, systems and processes in the model; `cosmos graph` exports the knowledge graph as
|
|
50
|
+
Mermaid, Graphviz DOT or JSON.
|
|
51
|
+
- `cosmos usage`: queries, denials, duration and estimated cost per metric, rule, user, agent and
|
|
52
|
+
data source.
|
|
53
|
+
- `cosmos suggest` (optional `ai` extra): Claude suggests concepts, rules, metrics and
|
|
54
|
+
descriptions; the engine validates each one and nothing is applied without review.
|
|
55
|
+
- `cosmos pack apply retail`: an industry pack mapped onto your tables by name and synonyms.
|
|
56
|
+
|
|
57
|
+
### Interfaces and interoperability
|
|
58
|
+
|
|
59
|
+
- REST API and MCP server (`search_concepts`, `explain`, `list_members`, `query`, `show_sql`),
|
|
60
|
+
over stdio or HTTP with OAuth protected resource metadata.
|
|
61
|
+
- Import from dbt (latest and legacy specs), Apache Ossie, Cube (static YAML) and Power BI (`.bim`
|
|
62
|
+
and TMDL), each with an equivalence test.
|
|
63
|
+
- Glossary export as SKOS/RDF (Turtle, JSON-LD, N-Triples) with `cosmos export skos` and
|
|
64
|
+
`GET /v1/glossary`.
|
|
65
|
+
- `cosmos init` creates a starter project with the e-commerce example and a local DuckDB source.
|
|
66
|
+
|
|
67
|
+
[0.1.0]: https://github.com/WiliamRosa/cosmos-semantic-platform/releases/tag/v0.1.0
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Contributing to Cosmos Semantic
|
|
2
|
+
|
|
3
|
+
Thank you for helping. Cosmos Semantic is open core ([ADR 0005](docs/decisions/0005-open-core.md)): everything that defines or computes a number lives in this repository under the Apache 2.0 license.
|
|
4
|
+
|
|
5
|
+
## Developer Certificate of Origin
|
|
6
|
+
|
|
7
|
+
Contributions use the [Developer Certificate of Origin](https://developercertificate.org/) (DCO), not a copyright assignment. Sign off every commit to certify that you wrote the change or have the right to submit it under the project's license:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
git commit -s -m "feat: describe the change"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
This adds a `Signed-off-by: Your Name <you@example.com>` line. Pull requests with unsigned commits cannot be merged.
|
|
14
|
+
|
|
15
|
+
## Development setup
|
|
16
|
+
|
|
17
|
+
Requires Python 3.11+, [uv](https://docs.astral.sh/uv/) and Docker (for Postgres and SQL Server).
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
uv sync --all-extras
|
|
21
|
+
docker compose -p cosmos-semantic -f deploy/docker-compose.yml --profile sqlserver up -d
|
|
22
|
+
|
|
23
|
+
export COSMOS_PG_URI=postgresql://cosmos:cosmos@localhost:15432/cosmos
|
|
24
|
+
export COSMOS_MSSQL_URI='mssql+pymssql://sa:Cosmos!Passw0rd@localhost:14330/master'
|
|
25
|
+
uv run pytest
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Without the two variables, the database-specific tests are skipped and only DuckDB runs. The Docker credentials are for local tests only.
|
|
29
|
+
|
|
30
|
+
## What every change needs
|
|
31
|
+
|
|
32
|
+
- **Same number everywhere.** Any change to the planner, connectors or SQL generation must keep the reference queries (`reference/`), the divergence zoo and the randomized cross-database test passing on DuckDB, Postgres and SQL Server. A new feature that computes numbers needs a reference case with hand-written SQL.
|
|
33
|
+
- **Formatting and lint:** `uv run ruff format src tests` and `uv run ruff check src tests`.
|
|
34
|
+
- **Schema:** after changing `src/cosmos_semantic/spec.py`, regenerate `schema/cosmos-semantic.v1.schema.json` with `uv run cosmos schema -o schema/cosmos-semantic.v1.schema.json`.
|
|
35
|
+
- **English** in code, comments, messages, tests and docs. Portuguese stays only where it is data (sample values, `pt` glossary labels).
|
|
36
|
+
- **Decisions:** a change to architecture or scope gets an ADR in `docs/decisions/`.
|
|
37
|
+
|
|
38
|
+
## Reporting security issues
|
|
39
|
+
|
|
40
|
+
Do not open a public issue for vulnerabilities; see [SECURITY.md](SECURITY.md).
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Cosmos Semantic
|
|
2
|
+
Copyright 2026 Wiliam Rosa
|
|
3
|
+
|
|
4
|
+
This product is licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
5
|
+
|
|
6
|
+
This product depends on third-party open source software, distributed under their own
|
|
7
|
+
licenses, including SQLGlot (MIT), Apache Arrow (Apache 2.0), Pydantic (MIT), DuckDB (MIT),
|
|
8
|
+
FastAPI (MIT) and the Model Context Protocol Python SDK (MIT). See each package's metadata for
|
|
9
|
+
its license text.
|