Changelog¶
What changed in each Semolina release. The full history of earlier releases is on the GitHub releases page.
0.10.0 (2026-11-20)¶
Labels and formats from DuckDB tags. semolina codegen now reads a DuckDB
semantic view member’s S_LAYER_LABEL, S_LAYER_KIND and S_LAYER_SPEC tags into
label= and semantic_format=, as it does on Snowflake, so a model generated from a
view that dbt-s-layer tagged gets them. The tags need version 0.17.0 or later of the
semantic_views extension; on an earlier one codegen --check doesn’t compare a
label= or semantic_format= you added by hand. On 0.17.0 or later it does, so a
hand-added one that the view’s tags don’t hold is reported as drift: move it into the
view’s tags, or drop it. A model generated from a tagged view by an earlier release has
neither argument, so codegen --check reports it as drift until you regenerate it. See
Describe your fields.
polars 2. fetch_polars() returns a
polars.DataFrame under polars 2. It used to return a one-column struct Series
there, because adbc-driver-manager before 1.13.0 did (apache/arrow-adbc#4915). Semolina now requires
adbc-poolhouse 1.8.1 or later, which brings adbc-driver-manager 1.13.0. The async
cursor already returned a frame, through a workaround in adbc-poolhouse that 1.8.1
drops. The async extra’s floor moves to 1.8.1 with the base one.
Fixed: DuckDB queries that select facts and dimensions. Version 0.18.0 of the
semantic_views extension refuses a semantic_view() call that lists both facts and
dimensions, so such a query failed with a Binder Error. Semolina now lists the facts
under dimensions, which groups on them and returns the same rows as Snowflake and
Databricks. A query that selects only facts is unchanged.
Facts with metrics on DuckDB. A DuckDB query can now select a fact beside a metric, or
filter a fact query on a metric. Semolina used to refuse it with ValueError. It now lists
the fact under dimensions, and the metric is computed per fact value, as on Snowflake and
Databricks. semolina codegen --check probes a DuckDB view with one query instead of two.
DuckDB queries with a fact beside a dimension or a metric need ``semantic_views`` 0.18.0
or later. An earlier release doesn’t take a fact under dimensions and answers “unknown
dimension”. INSTALL doesn’t update a cached extension, so if yours is older, run
UPDATE EXTENSIONS (semantic_views). See Developing on DuckDB, deploying elsewhere and
Check the extension’s release.
0.9.1 (2026-10-27)¶
s-layer-semantic-formats 0.2.0. Semolina now requires s-layer-semantic-formats
0.2.0 or later, below 0.3. That release renames SLayerBlock to SemanticFormat, so
semantic_format on a field is now typed and returned as a SemanticFormat. If your
own code imports SLayerBlock from s_layer_semantic_formats, import
SemanticFormat instead. Semolina 0.9.0 does not cap that dependency, so a fresh install
of 0.9.0 picks up 0.2.0 and fails to import; upgrade to this release instead.
Formats from a Databricks metric view’s own YAML. semolina codegen now reads the
native format of a Databricks metric view’s dimensions and measures into
semantic_format= when the column has no S_LAYER_* tags, so a metric view written by
hand gets one too. The tags still win where both are present. See
Describe your fields for what maps. A model generated from such a view by an
earlier release has no semantic_format=, so codegen --check reports it as drift
until you regenerate it.
DuckDB 2.0. The duckdb extra now pins DuckDB 2.0.0, which installs version 0.16.0
or later of the semantic_views extension, so time grains run on DuckDB.
semantic_views 0.16.0 keeps DuckDB’s own result types, which changes one you may rely
on: SUM over an integer column is a HUGEINT and arrives as decimal.Decimal,
where it used to be narrowed to a 64-bit int. semolina codegen annotates such a
metric decimal.Decimal | None, so codegen --check reports a model generated by an
earlier release as drift until you regenerate it. Cast in the view’s metric expression if
you want an int. DuckDB 2.0 also streams results, so aexecute() returns once the
statement is prepared and the query runs during the fetch: a timeout that wraps only
aexecute() no longer bounds the query, so put the fetch inside it as well.
Fixed: DuckDB derived metrics in codegen. A metric built from other metrics, which
DESCRIBE SEMANTIC VIEW reports with the kind DERIVED_METRIC, was left out of a
model generated from a DuckDB semantic view. It now introspects as a metric, so
codegen --check reports a model generated by an earlier release as drift until you
regenerate it.
0.9.0 (2026-10-26)¶
Build a query from field names. semolina.spec builds a query from plain data,
{"metrics": ["revenue"], "where": {"field": "region", "op": "eq", "value": "West"}},
for callers that hold names instead of model attributes, such as an agent’s tool call or a
JSON request body. Filters are and / or / not trees over the same operators as
the field methods. Mistakes raise the new SemolinaSpecError with the path to the bad
value, and query_spec_schema() gives a JSON Schema listing one model’s field names, to
use as a tool’s input schema. How to build a query from field names has the details.
Group by a time grain. Orders.ordered_at.grain("week") selects a date or timestamp
dimension rolled up to a year, quarter, month, week, day, hour, minute or second, in a
column named ordered_at__week. Every backend returns a date for a day or coarser and
a datetime below that, and weeks start on Monday, whatever Snowflake’s WEEK_START
says. On DuckDB it needs semantic_views 0.16.0 or later, which runs on DuckDB 2.0, so
it doesn’t run with the DuckDB 1.5.6 that the duckdb extra pins. Group by a time grain
has the details.
Describe your fields. Metric, Dimension and Fact take label=,
description=, synonyms= and semantic_format=, and a model takes
description= for its view. semantic_format is an S-LAYER block from the new
s-layer-semantic-formats dependency, validated against the field’s kind when the class
is defined. semolina codegen writes what each backend records as these arguments
instead of a field docstring: comments and synonyms everywhere, Databricks’
display_name as the label, and on Snowflake and Databricks the S_LAYER_* tags
dbt-s-layer writes, as the label (Snowflake) and the format. --check reports any of
them that no longer match the warehouse. A model generated by an earlier release reports
drift wherever the warehouse records a comment or synonyms, since it has none of these
arguments: regenerate it once. Snowflake introspection now also runs
DESCRIBE SEMANTIC VIEW and one TAG_REFERENCES query, and Databricks introspection
reads information_schema.column_tags. Describe your fields has the details.
Fixed: Snowflake derived metrics in codegen. A view-level derived metric, which
Snowflake reports with the kind DERIVED_METRIC, now introspects as a metric. It used
to come back with a derived_metric role that no field class matches.
Fixed: date and time filters on Snowflake. A .where() value that is a date,
datetime or time failed at execution on Snowflake with Unsupported bind param
type, because the Snowflake ADBC driver can’t bind those types. Semolina now writes them
into the SQL as literals and keeps binding everything else.
0.8.0 (2026-10-19)¶
Databricks Lakehouse//RT. create_engine and create_async_engine accept
adbc-poolhouse’s DatabricksPythonConfig, or type = "databricks-python" in
.semolina.toml. It connects through databricks-sql-connector instead of the ADBC
driver, which is the only way to reach Lakehouse//RT. You get the same DatabricksEngine,
so your models and queries don’t change, and dispose() closes its pool.
Connect to Lakehouse//RT with the Python connector has the setup.
An in-memory DuckDB pool holds more than one connection. Semolina now requires
adbc-poolhouse 1.7.0, which drops the pool_size=1 limit on database = ":memory:".
An in-memory pool defaults to 5 connections, and every one of them shares the same
database, so concurrent and async queries no longer need a database file. Create your
tables and views once rather than on each new connection:
How to test query code without a warehouse shows how.
The testing tutorial and the warehouse-testing guide seed their in-memory fixtures the same way.
0.7.0 (2026-10-16)¶
0.7.0 adds an async query surface and typed results. It also fixes several 0.6 queries that ran without complaint and returned the wrong rows. Read the first two sections before you upgrade from 0.6.
Changes that need action¶
The semolina command needs the [cli] extra. typer, rich and jinja2 are
no longer base dependencies, so pip install semolina no longer installs what
semolina codegen and semolina codegen-dto need. griffelib, which is new in 0.7 and
reads committed files for --check, is in the extra too. Install the command with:
pip install "semolina[cli]"
Without the extra, semolina prints that line and exits with code 2. A service that
only runs queries skips the command’s packages, and import semolina defers
pydantic-settings and SQLAlchemy until you call create_engine.
The SQL-generation base class is SQLDialect. Only one thing in Semolina is now
called Dialect: the enum you pass to to_sql(). If you subclassed the base class
through semolina.engines.sql.Dialect or semolina.engines.DialectABC, rename it.
Both old names still work in 0.7 with a DeprecationWarning.
Result columns are named after your fields on every warehouse. Semolina now aliases
each selected column to its Python field name, so row.revenue works on Snowflake,
Databricks and DuckDB alike. In 0.6 the same query returned AGG("REVENUE") on
Snowflake and measure(revenue) on Databricks. If your code read those keys, read
the field names instead.
A filter given None raises TypeError. In 0.6 a filter such as
Sales.revenue >= None compiled to a comparison with NULL, which matches no row,
so the query quietly came back empty. Now every comparison and lookup refuses None
when you build it, and so does a None inside in_(). == and != are the
exception (see below). If your code passes an optional parameter straight into a filter,
leave the filter out when the value is None, or use .isnull() if you meant to
match missing values.
A connection failure raises SemolinaConnectionError. In 0.6 a connection that
could not be opened, in create_engine() or when execute() checked one out of the
pool, raised the driver’s own error. Now it raises SemolinaConnectionError, with the
driver’s error as __cause__, the same as introspect() already did. If you catch
adbc_driver_manager.Error around those calls to answer a warehouse that is down, catch
SemolinaConnectionError too. A statement the warehouse rejects still raises the
driver’s own error. On DuckDB, a connection that cannot install or load the
semantic_views extension raises SemolinaExtensionLoadError, a subclass of
SemolinaConnectionError whose message names the extension.
Fixed¶
Each of these ran without an error in 0.6 and returned the wrong result. 0.7 either returns the right rows or refuses the query with an exception.
in_()given a string, such asSales.country.in_("US"), treated each character as a separate value. It now raisesTypeError. It also accepts a generator, and the SQL always has as many placeholders as there are values.field == Noneandfield != Nonecompiled to= NULLand<> NULL, which match nothing. They now compile toIS NULLandIS NOT NULL. Every other comparison or lookup givenNone,between()and aNoneinsidein_()among them, raisesTypeErrorand points you at.isnull().startswith,istartswith,endswith,iendswithandiexacttreated%and_in your value as wildcards. They now match them literally on every dialect.likeandilikestill pass your pattern through as written.A result with two columns of the same name, which selecting one field twice produces, silently kept the last value. Selecting a field twice now raises
ValueErrorin the builder, and aRowrefuses duplicate column names.On DuckDB, a query that selects facts and no metric returned one row per source row, where Snowflake and Databricks group the same query. DuckDB now returns each distinct row once too.
Two more raised an error where they should have worked:
On DuckDB, a DBAPI fetch after the result was drained, such as the last call of a
while batch := cursor.fetchmany_rows(100)loop, raisedInternalError. Every DBAPI fetch now returns[]orNoneonce the result is drained.semolina codegen --backend my_module.MyEnginecould not import a module in the working directory unless it was installed. Both codegen commands now add the working directory to the end ofsys.pathfirst.
Changed¶
to_sql()with no argument previews the dialect of the engine.using()names, when that engine is registered. Without.using(), it still previews Snowflake.Every exception class Semolina defines derives from
SemolinaError, so oneexceptclause can catch them all. Each keeps its 0.6 base class, so existingexcept RuntimeErrorandexcept ValueErrorclauses still match. Looking up an engine that was never registered raisesSemolinaEngineNotRegisteredError, which is still aValueError. A result with two columns of one name, which only a custom engine can produce, raisesSemolinaDuplicateColumnsError, still aValueError. Both new errors are importable fromsemolina.introspect(), and sosemolina codegen, reports a view the warehouse reached but could not describe, such as one whose definition no longer binds, as the newSemolinaIntrospectionErrorrather thanSemolinaConnectionError, andsemolina codegenexits 6 for it rather than 4. Connection and authentication failures still raiseSemolinaConnectionError.Queryis public, andField,Engine,AsyncEngine,And,Or,NotandLookupare importable fromsemolina. The query builder’s methods are typed, so a type checker flags.metrics(Sales.country)or.limit("10"). A query reports its state through read-only properties:selected_metrics,selected_dimensions,filters,ordering,limit_value,engine_nameandmodel.IntrospectedViewandIntrospectedField, the typesintrospect()returns, live insemolina.introspection. Importing them fromsemolina.codegen.introspectorstill works.
Added¶
aexecute()and async row streaming, under asyncio or Trio, with the[async]extra. Cancelling a query stops it inside the driver..into(Model)turns a result into Pydantic models, andfetch_df()andfetch_polars()return a pandas or polars DataFrame.semolina codegen-dtowrites the Pydantic model for a query’s result, typed from the warehouse’s own result schema.semolina codegen --checkreports where your models no longer match the warehouse, and--outputwrites the generated module to a file.to_sql()takes a dialect object as well as a name, so you can preview a custom dialect’s SQL without registering an engine. Each built-in dialect names its backend inkind.
See also¶
Installation covers the extras,
[cli]among them.How to run Semolina inside FastAPI shows how to catch
SemolinaErrorin a request handler.How to filter queries covers filters, including
Noneand the string lookups.