vela Get started

Bridging Semantic Layers with Semglot: A New Approach to Uni

July 21, 20265 min read

Key takeaways

  • Semglot automates conversion between disparate semantic model formats, eliminating manual copy‑and‑paste updates.
  • The library provides a deterministic, extensible pipeline that ensures fair scoring of analytics agents on benchouse.ai.
  • Built on a normalized internal representation, Semglot can easily add new target formats via lightweight plugins.
  • Open‑source MIT licensing encourages community contributions and rapid adoption across the data stack.

Analytics agents—whether they are dbt models, Snowflake semantic views, or custom YAML specifications—need a common frame of reference to be evaluated fairly. André, one of the founders of benchouse.ai, faced a tedious manual process: every time the reference semantic model changed, he had to update dozens of agent definitions across multiple formats. The solution he built, Semglot, brings the power of sqlglot to the world of semantic layers, enabling seamless translation from one model representation to another.

---

The Problem: Fragmented Semantic Definitions

When you run a public leaderboard for analytics agents, consistency is king. Each participant submits a model that describes the business logic of a dataset—its dimensions, measures, and relationships. However, the data community does not agree on a single schema definition language. Some teams publish dbt documentation, others rely on Snowflake's semantic views, and many startups create bespoke YAML schemas. This heterogeneity creates two major pain points:

1. Maintenance Overhead – A change in the reference model (e.g., adding a new dimension) forces you to edit every downstream definition manually. 2. Scoring Inconsistency – If agents are evaluated against slightly different contexts, the leaderboard results become biased.

Until now, the only practical workaround was a painstaking copy‑and‑paste routine, prone to human error and version drift.

---

Enter Semglot: The Sqlglot for Semantic Layers

Semglot is a lightweight, MIT‑licensed Python library that reads a semantic model in one format and emits an equivalent model in another. It borrows the parsing and transpilation philosophy of sqlglot—a well‑known SQL parser and transpiler—and applies it to the metadata that defines a semantic layer.

Core Features

- Multi‑Target Support – Out‑of‑the‑box, Semglot can read dbt documentation and generate models for six different targets, including Snowflake semantic views, Looker manifests, and generic YAML schemas. - Extensible Architecture – Adding a new target is as simple as implementing a small set of transformer functions; the library’s plugin system discovers them automatically. - Deterministic Output – Given the same input, Semglot always produces identical output, guaranteeing reproducibility for leaderboard scoring. - Zero‑Runtime Dependencies – Apart from the standard library, Semglot only requires pydantic for model validation, keeping the footprint minimal.

---

How Semglot Works Under the Hood

1. Parsing – Semglot ingests the source model (e.g., a schema.yml from dbt) and builds a normalized internal representation using Pydantic models. This representation captures entities such as dimensions, measures, joins, and filters. 2. Validation – The internal model is validated against a shared semantic contract. Inconsistent definitions (e.g., a measure referencing a non‑existent dimension) raise clear exceptions. 3. Transformation – Target‑specific transformers map the normalized representation to the syntax and conventions of the destination format. For Snowflake, this includes generating CREATE SEMANTIC VIEW statements; for Looker, it produces view files with appropriate sql blocks. 4. Emission – The final step writes the transformed artifacts to disk or streams them to a CI pipeline.

Because each stage is isolated, developers can test and debug transformations independently, dramatically reducing the time required to onboard new agents.

---

Real‑World Impact on Benchouse.ai

Benchouse.ai’s leaderboard aims to be the "Kaggle for analytics agents." To achieve this, the platform needs a single source of truth for the semantic context against which every submission is scored. By integrating Semglot, the team realized several immediate benefits:

- Reduced Update Cycle – Updating the reference model now requires a single commit; Semglot automatically propagates the change to all six target formats. - Improved Fairness – All agents are evaluated against an identical, version‑controlled context, eliminating hidden biases. - Scalable Agent Onboarding – New participants can submit models in any supported format; Semglot normalizes them before they enter the scoring pipeline.

The open‑source nature of Semglot also invites community contributions, ensuring that emerging semantic standards can be added without waiting for a core maintainer.

---

Getting Started with Semglot

`bash ## Install the library pip install semglot

Convert a dbt model to a Snowflake semantic view semglot \ --input-path path/to/dbt/schema.yml \ --output-format snowflake \ --output-dir path/to/snowflake/views ```

The CLI mirrors the simplicity of sqlglot’s command‑line interface, making it easy to embed in CI/CD workflows. For programmatic use, the library exposes a straightforward API:

`python from semglot import Semglot

converter = Semglot(source='dbt', target='lookml') semantic_model = converter.read('models/schema.yml') lookml_output = converter.write(semantic_model) `

---

Future Roadmap

While Semglot already supports six targets, the roadmap includes:

- GraphQL‑Based Semantic APIs – Directly generate GraphQL schema definitions for modern data mesh platforms. - Bidirectional Diffing – Compare two semantic models and output a migration plan. - Integration with Data Catalogs – Pull source definitions from tools like Alation or DataHub. - Performance Optimizations – Parallelize large model conversions for enterprise‑scale deployments.

Community feedback will shape the priority list, and contributions are welcomed via the project's GitHub repository.

---

Conclusion

Semantic interoperability has long been a hidden bottleneck in the analytics ecosystem. By abstracting the translation of semantic definitions, Semglot empowers organizations like benchouse.ai to maintain a single, authoritative context while supporting a diverse set of agent formats. Its open‑source license, extensible design, and low operational overhead make it a compelling addition to any data‑centric workflow.

If you’re building a platform that scores, validates, or shares analytics models, give Semglot a try—your future self will thank you.

---

Ready to explore? Visit the [Semglot repository on GitHub](https://github.com/benchouse/semglot) and start contributing today.

Sources: https://github.com/benchouse/semglot

More field notes

Start smaller than feels respectable.