Model once. Reuse everywhere. SQL with superpowers.
Try it Out
Real queries on a real dataset. Head to the demo for a larger walkthrough and freeform queries.
import std.display;
const unknown_cabin <- 'Unknown';
def safe_rate(part: int, whole: int, digits: int = 1) ->
case
when whole = 0 then 0.0::percent
else round(part::float / whole, digits)::percent
end;
def get_cabin_type(cabin: string) ->
case
when cabin = unknown_cabin then unknown_cabin
else substring(cabin, 1, 1)
end;
auto cabin <- unnest(split(coalesce(passenger.cabin, unknown_cabin), ' '));
auto cabin_type <- @get_cabin_type(coalesce(passenger.cabin, unknown_cabin));
WHERE
passenger.age is not null
SELECT
passenger.class,
cabin_type,
count(cabin) as cabin_assignments,
@safe_rate(sum(passenger.survived), cabin_assignments) as survival_rate
HAVING
cabin_assignments > 5
ORDER BY
survival_rate desc
;
Familiar
It's like TypeScript vs JavaScript; gentle learning curve, no YAML.
Accurate
Chasm, fan out, nulls and other traps handled automatically.
Testable
Type check. Unit test. Integration test. Version.
Efficient
Automatic use of the most efficient table. A native OLAP engine that understands semantics.
Extensible
Open source. Rich Python API. Integrates with your favorite tools.
Composable
Models as building blocks: share, reuse, and compose with ease.
Perfect for AI
Fast feedback. Strong guardrails. Constrained context.
Shared semantic infrastructure
One model.
More context.
Physical data is presented through a stable semantic interface, then expands again as people and agents bring context to every question - there is no separation between interactive exploration and the curated semantic layer; people and agents can work seamlessly across both and then promote up locally valuable work to the shared layer to make it visible and reusable.
A typed semantic model turns physical structure into a stable, reusable interface that can be tested and evolved.
Familiar Problems?
Informed by the challenges every company has with modern data tooling. Open source so we don't keep having to solve them.
How it works
Define concepts and sources
Build your model iteratively in the same language you query with—no YAML required.
import station as start_station;
import station as end_station;
key ride_id int;
property ride_id.ride_start_time timestamp; # UTC start time
property ride_id.ride_end_time timestamp; # UTC end time
auto ride_seconds <- date_diff(ride_start_time, ride_end_time, second);
auto ride_date <- date_trunc(ride_start_time, day);
datasource rides (
ride_id: ride_id,
start_time: ride_start_time,
end_time: ride_end_time,
start_station: start_station.id,
end_station: end_station.id
)
grain (ride_id)
address rides;
# size our data
select count(ride_id) as ride_count;
Query with the full flexibility of SQL
Fan-out joins, foreign keys, and complex logic are resolved automatically through the model.
auto daily_rides <- count(ride_id) by ride_date;
SELECT
day_of_week,
rank start_station.id by avg(daily_rides) desc as daily_station_rank
HAVING
daily_station_rank <5
;
Persist the result
Materialize trusted outputs without switching tools or rewriting logic.
PERSIST daily_ranking INTO tbl_dow_ranking FROM
SELECT
day_of_week,
start_station.id,
daily_station_rank,
;
Reuse
Promote definitions to your core model, deploy them, and reuse them everywhere.
import core_ride_metrics;
WHERE end_station.id in (start_station.id ? daily_station_rank <= 3)
SELECT
ride_id,
start_station.id,
end_station.id,
ride_seconds
ORDER BY
ride_id asc
;
Built with Trilogy
Data experiences built with trilogy - from preprocessing to presentation.

GCAT Space Dataset Explorer
Interactive chat + visual exploration for launches, vehicles, satellites, and operators based on a rich space exploration dataset.

About Urban Trees
An interactive browser-based map of US urban forests. Explore hundreds of thousands of street trees by location, species, and ecological attributes across cities like NYC and SF.
A Full Analytics Stack
Free and open source. Always. Easy to try, easy to adopt, easy to scale.
- A language to simplify your SQL.
- An open-source UI to query, chart, and debug your data.
- A CLI to query and manage assets in your data warehouse.
- A Python SDK to embed it wherever you need.
- All the AI native tools you expect.
Install
Python SDK
Powerful, expressive Python API for embedding the language in larger workflows.
pip install pytrilogy
CLI
A streamlined CLI experience for creating, updating, and sharing Trilogy models.
pip install pytrilogy[cli]
UI
Explore, query, and dashboard your data.
Your favorite editor, VS Code, or Trilogy Studio - which you can clone or run in docker.
The free, hosted version of the Trilogy Studio IDE is an easy way to try out Trilogy.