Skip to content

Semantic Layer Guides#

The semantic layer compiles metric definitions written in dbt semantic YAML over feature groups, and answers metric queries with SQL it generates for Trino. Define the metrics, compile them into a build, then query them from Python, the CLI, the UI, an agent, a dbt Semantic Layer client or a BI tool, chart them in Superset, or export them into feature groups. Administrators turn the service on as in Semantic Layer administration.

  • Start here


    Register a folder of semantic YAML, compile it, and query a metric by a dimension of another feature group.

    hops semantic create sales --path Resources/semantic/sales
    hops semantic compile sales --wait
    hops semantic query sales --metrics revenue --group-by customer__country
    

    Overview · Define metrics · Query metrics

Define

  • Overview The service, semantic projects, builds, metrics and the serving modes.
  • Get started Scaffold a semantic project from feature groups, optionally in a new GitHub repository.
  • Define metrics Semantic models over feature groups, and the fields every metric has.
  • Metric types Cumulative and conversion metrics, offsets, filled gaps, semi-additive measures and SCD dimensions.
  • Time spine The feature group with one row per period that windows and offsets join to.

Check

  • Edit definitions in the UI The YAML in the browser, validated as you type, saved without overwriting another edit.
  • Compile and builds When builds happen, FOLLOW and PINNED, promote, and errors at file and line.
  • Validation rules Every check of a compile, and what it reports.
  • Tags Schematised tags on semantic projects, metrics and saved queries, and mandatory tags.

Query

  • Query metrics The Python client, the CLI, the query workbench in the UI, and the limits.
  • Saved queries Named metric queries, run and refined from every client.
  • Result cache Repeated queries answered from memory, and what makes a result fresh.
  • Query history Every query on every API, who ran it, how long it took and why it failed.

Connect

  • Connect dbt clients dbt-sl-sdk, the Arrow Flight SQL JDBC driver and ADBC for queries, GraphQL for metadata.
  • Connect BI tools Semantic projects as tables for DBeaver, JDBC and ODBC tools, Tableau and Power BI.
  • Excel and ODBC The Arrow Flight SQL ODBC driver, and metrics as CSV for Excel's From Web.
  • Metric exports Saved queries written into feature groups by scheduled jobs, and answered from them.
  • Dashboards in Superset Superset dashboards and charts from metrics, and Explore links.
  • Agent tools The semantic layer tools of the Hopsworks MCP server.