Skip to content

v2.1.0: Time zones, time of day, Ossie windows and ontologies

Latest

Choose a tag to compare

@ZmeiGorynych ZmeiGorynych released this 27 Nov 15:25
9782058

SLayer 2.1.0

A big step towards full Ossie Layer 1 support, plus time zones, a time-of-day type and the first use of Ossie ontologies.

Time zones and time of day

You can now set time_zone on a query: results are bucketed, compared and returned in that zone, and relative dates and now() / current_date() read the clock in that zone. Declare the zone your timestamps are stored in with time_zone on the datasource or on an individual field (or civil for wall-clock values). Queries without a time_zone behave exactly as before. See docs/concepts/time.md.

Time is now a real time-of-day type: you can group, filter, order and take min / max over it, extract hour / minute / second, and write TIME '08:30:00', current_time() and CAST(x AS TIME) on every supported database (ClickHouse needs server 25.6 or later). Database TIME columns now ingest as Time.

More of the Ossie expression language

  • Window functions with OVER (PARTITION BY ... ORDER BY ... ROWS/RANGE ...) now work in field definitions, metrics and queries, including portable (Ossie) fields and metrics. A window over row-level values is computed over its dataset's rows before any join or query filter.
  • New aggregations sum_distinct, avg_distinct, percentile_disc and percentile_approx, also readable as SUM(DISTINCT x), PERCENTILE_DISC(p) WITHIN GROUP (ORDER BY x) and APPROX_PERCENTILE(x, p). percentile and median are now exact on ClickHouse too.
  • New scalar functions and spellings: IF, NVL, NVL2, STARTSWITH, ENDSWITH, CHARINDEX, TRUNCATE, TO_DATE, TO_TIMESTAMP, zeroifnull, nullifzero, trunc(x, d), radians, degrees, regexp_count, TIMESTAMP_NTZ literals and the millisecond date part. dayofweek as a date part is ISO (Monday 1 to Sunday 7).
  • A quoted name in Ossie's upper-case form ("AMOUNT" for a field amount) now resolves, and on SQLite an untyped document field gets the type ingestion would give it.

Ontologies

slayer import-osi now imports Ossie ontology and mapping documents instead of refusing them. They are checked, stored, exportable and manageable through Python, REST, the CLI and MCP. inspect and search show what each dataset, field and relationship means in the ontology (search also takes concept:<Concept>), and validate_datasets reports where your model or data disagrees with the ontology.

Fixes

first / last over an aggregate are now ordinary aggregations, usable in every aggregation position and with partition_by=. Several ranking and time transforms (rank, cumsum, lag, lead, time_shift, change) returned wrong values or failed when mixed with coarser aggregates, windowed aggregates or aggregations around them; they now match their standalone values. time_shift (and so change / change_pct) now always evaluates its operand over the shifted date range, so composite operands and time_shift(cumsum(...)) at the first visible bucket read the earlier period instead of NULL, the same way in spine and non-spine queries. A filter using a re-aggregation no longer breaks when another metric reads across a relationship, and a relationship you name time_spine no longer breaks spine queries. This release also contains the 1.9.2 fixes: joined mixed-case columns on Postgres / Snowflake / Oracle, sums over a child dataset that do not fan out, x in ('a'), a reproducible demo dataset and a faster slayer mcp --demo startup.

Behaviour changes to check

  • round(x, d) and trunc(x, d) require an integer d.
  • current_time is now a keyword; a field with that name must be written quoted. A stored custom granularity named current_time is renamed current_time_granularity on upgrade.
  • Time fields and casts to TIME return time-of-day values instead of the driver's raw value, and a re-ingest re-types stored DateTime / String fields over TIME columns to Time.
  • A first / last whose ranking key is also a query dimension now returns one value per coarser cell, and an associated first / last supplies rows like sum.
  • Deleting or changing a dataset, field or metric that a stored model-scoped metric reads is now refused, listing what it would break; such broken metrics already in storage load as unloadable.
  • A field defined by a window function is computed over its dataset's rows, so raw-row queries that filter on other columns may return different window values than before.
  • Datasources with a renamed custom granularity are stored at a new version that SLayer 2.0.x cannot read.