feat: add Sigma data model connector#28
Open
mattsenicksigma wants to merge 4 commits into
Open
Conversation
Adds a new `sigma` connector that ingests Sigma data model YAML files (exported from the Sigma REST API) into four new tables: - AGENTS.SIGMA_DATA_MODEL — one row per .sigma.yaml file - AGENTS.SIGMA_ELEMENT — one row per kind:table element (warehouse source) - AGENTS.SIGMA_COLUMN — columns with direct/computed classification - AGENTS.SIGMA_METRIC — simple SQL-aggregate metrics only Key design decisions: - source_path (dotted warehouse path e.g. ANALYTICS.REVENUE.ORDERS) is the primary key for elements; when two data models reference the same table the first file alphabetically wins, keeping the schema consistent - Metrics are filtered to Sum/Avg/Count/CountDistinct/Min/Max over a single column reference; conditional, cross-metric, and multi-field formulas are silently skipped since they have no direct SQL aggregate equivalent - Columns carry a kind column (direct/computed) to distinguish bare warehouse references from derived expressions - Malformed YAML files (empty, scalar) raise ValueError with a clear message rather than an opaque AttributeError mid-ingest Includes 103 tests, a sigma-setup.md guide, reusable GitHub Actions workflow and composite action, SPEC.md table definitions, and README/root.py updates. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mattsenicksigma
requested review from
abhijeethp,
kevinskim93 and
levonkorganyan
as code owners
June 30, 2026 08:20
Author
|
A more human comment Sigma Data Models are OSI compliant, and this conversion tries to map all elements to items maintained by the concepts of this repo The following considerations were made in the making of this pr:
|
levonkorganyan
left a comment
Contributor
There was a problem hiding this comment.
@mattsenicksigma Pending merge conflict resolution this is good to go
Author
|
@levonkorganyan / @abhijeethp resolved the one line conflict, just need a restamp here and I can merge! |
Author
|
@levonkorganyan / @abhijeethp just resolved the new merge conflict |
abhijeethp
approved these changes
Jul 24, 2026
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.
Summary
Adds a
sigmaconnector that ingests Sigma data model YAML files into four new normalized tables, giving agents a queryable semantic surface for Sigma workbooks.AGENTS.SIGMA_DATA_MODEL— one row per.sigma.yamlfile (name, description, source file path)AGENTS.SIGMA_ELEMENT— one row perkind: tableelement; PK is the dotted warehouse path (ANALYTICS.REVENUE.ORDERS), which joins to the column and metric tablesAGENTS.SIGMA_COLUMN— all columns with akindfield (directfor bare[TABLE/Col]references,computedfor derived expressions)AGENTS.SIGMA_METRIC— metrics whose formula is a single standard SQL aggregate (Sum,Avg,Count,CountDistinct,Min,Maxover one column)Design decisions worth noting
source_pathas PK, not Sigma's UUID. The warehouse path is human-readable, stable across data model renames, and meaningful to agents querying the table. Sigma's internaldataModelId/elementidfields are opaque UUIDs that convey nothing to a language model.Metric filtering. Only metrics with a direct SQL aggregate equivalent are written. Conditional aggregations (
SumIf,CountDistinctIf), cross-metric references ([Metrics/A] / [Metrics/B]), multi-field expressions (Sum([Qty] * [Price])), and statistical functions (PercentileCont) are silently skipped. The SPEC documents exactly which patterns are excluded and why.Deduplication. When two data model files reference the same warehouse table, the first file alphabetically wins. This is deterministic (files are sorted before ingest) and documented in SPEC.
ai_contextnot included. Sigma exposes AI context in the UI (File > Set AI context) but it is not returned by theGET /v2/dataModels/{id}/spec?format=yamlAPI endpoint used to export data model YAML — confirmed against the API spec. It cannot be ingested.Malformed YAML safety. An empty or non-mapping
.sigma.yamlfile raisesValueErrorwith a clear message ("{file}: expected a YAML mapping, got NoneType") rather than an opaqueAttributeErrormid-ingest.ValueErroris now also caught at the CLI level (this also improves the existinglookmlconnector, which raisesValueErrorfor unterminated blocks).Files changed
src/agents_schema/sigma.pysrc/agents_schema/cli.pysigmasubcommand;ValueErroradded to error handlersrc/agents_schema/root.pytests/test_sigma.pytests/test_root.pytests/test_connector_root.pySPEC.mdsigma-setup.mdREADME.mdpyproject.toml.github/workflows/agents-schema-sigma.yml.github/actions/agents-schema-sigma/action.ymlVersion pin note
The composite action pins
agents-schema==0.0.9. The sigma subcommand will be available once a new version is published to PyPI — the pin should be updated to that version before the action is live. Happy to do that in a follow-up commit once the release version is decided.Test plan
pytest tests/)agents-schema sigma --sigma-dir <path>works against a real Sigma YAML exporttest_connector_root.py)🤖 Generated with Claude Code