Enhanced Trilogy for common ETL needs.
Project description
Simple Declarative Data Pipelines
Combine the simplicity of Trilogy with the tools of modern orchestration, such as DBT and Dagster.
[!TIP] Pitch: don't worry about optimizing your ETL staging tables ever again - write your final tables and let TrilogyT handle the rest.
Compile your models to ETL scripts to run on demand. Rebuild, run, and test easily.
Translates 'Persist' statements in Trilogy to scheduled ETL jobs.
Currently supported backends:
- trilogy (optimize a Trilogy model, execute in memory)
- dbt (optimize a Trilogy model, translate it to a DBT project, optionally execute with dbt CLI)
- dagster (optimize a trilogy model, translate it to a dagster project, optionally execute with dagster CLI)
[!WARNING] This is an experimental library. The API is subject to change.
Flags
--optimize=X - Any CTE used at least X times in calculating final model outputs will be materialized for reuse.
Install
pip install pytrilogyt
How to Run
trilogyt <preql_path> <output_path> --run
Trilogy
Optimize and (optionally) execute a trilogy script (or set of scripts)
trilogyt trilogy trilogy/scripts trilogy/build bigquery --run
DBT
For dbt, the output_path should be the root of the dbt project, where the dbt_project.yml file exists.
An example command:
trilogyt dbt dbt/trilogy/ dbt bigquery --run
Each source .preql file will be built into a separate DBT sub folder with one model per persist statement. If optimization is enabled (default), there will be optional "optimization" tables that can be imported and depended on.
17:12:37 Running with dbt=1.7.4
17:12:38 Registered adapter: bigquery=1.7.2
17:12:38 Found 4 models, 4 tests, 0 sources, 0 exposures, 0 metrics, 447 macros, 0 groups, 0 semantic models
17:12:38
17:12:40 Concurrency: 4 threads (target='dev')
17:12:40
17:12:41 1 of 4 START sql view model dbt_test.customers ................................. [RUN]
17:12:41 2 of 4 START sql table model dbt_test.customers_preql_preqlt_gen_model ......... [RUN]
17:12:41 3 of 4 START sql table model dbt_test.my_first_dbt_model ....................... [RUN]
17:12:42 1 of 4 OK created sql view model dbt_test.customers ............................ [CREATE VIEW (0 processed) in 1.09s]
17:12:43 3 of 4 OK created sql table model dbt_test.my_first_dbt_model .................. [CREATE TABLE (2.0 rows, 0 processed) in 2.78s]
17:12:43 4 of 4 START sql view model dbt_test.my_second_dbt_model ....................... [RUN]
17:12:44 2 of 4 OK created sql table model dbt_test.customers_preql_preqlt_gen_model .... [CREATE TABLE (100.0 rows, 4.3 KiB processed) in 3.55s]
17:12:44 4 of 4 OK created sql view model dbt_test.my_second_dbt_model .................. [CREATE VIEW (0 processed) in 1.10s]
17:12:44
17:12:44 Finished running 2 view models, 2 table models in 0 hours 0 minutes and 6.37 seconds (6.37s).
17:12:45
17:12:45 Completed successfully
17:12:45
17:12:45 Done. PASS=4 WARN=0 ERROR=0 SKIP=0 TOTAL=4
customers: success
my_first_dbt_model: success
customers_preql_preqlt_gen_model: success
my_second_dbt_model: success
[!TIP] Remember - you don't need to run the model with Trilogy. You can embed trilogy into a larger DBT project and use normal DBT tooling to manage the output.
Dagster
For Dagster, each source .preql file will be built as a model, with one entrypoint script that imports all resources. If optimization is enabled (default), there will be optional "optimization" tables that can be imported and depended on.
An example command:
trilogyt dagster dbt/models/core/ ./dbt bigquery --run
[!TIP] Remember - you don't need to run the model with Trilogy. You can embed a portion of Trilogy generated models into a larger Dagster project.
From IO
Write-Output native """constant x <-5; persist into static as static select x;""" | trilogyt <output_path> bigquery
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytrilogyt-0.0.20.tar.gz.
File metadata
- Download URL: pytrilogyt-0.0.20.tar.gz
- Upload date:
- Size: 25.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02ff1b26e4accc81b8d3438d32389643f0152d2b078751be0fadb9657ffe8555
|
|
| MD5 |
cfc1510830a6587871fc234d1619c6d3
|
|
| BLAKE2b-256 |
7b8a154a3eb95a8d563e83e4d7f75d86442ef17de7e73e3d9995457b0eefeb9c
|
Provenance
The following attestation bundles were made for pytrilogyt-0.0.20.tar.gz:
Publisher:
pythonpublish.yml on trilogy-data/pytrilogyt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytrilogyt-0.0.20.tar.gz -
Subject digest:
02ff1b26e4accc81b8d3438d32389643f0152d2b078751be0fadb9657ffe8555 - Sigstore transparency entry: 771196131
- Sigstore integration time:
-
Permalink:
trilogy-data/pytrilogyt@7c52e06bef048e1f2e064d5e2b555a8084ee57ad -
Branch / Tag:
refs/heads/main - Owner: https://github.com/trilogy-data
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pythonpublish.yml@7c52e06bef048e1f2e064d5e2b555a8084ee57ad -
Trigger Event:
push
-
Statement type:
File details
Details for the file pytrilogyt-0.0.20-py3-none-any.whl.
File metadata
- Download URL: pytrilogyt-0.0.20-py3-none-any.whl
- Upload date:
- Size: 32.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d033ca095f20b1ea4a6bb69d8ad375ec48662609eadb3898e2f5518e1a48ee5e
|
|
| MD5 |
99f397be2583eee1b0cf54b80602bd8e
|
|
| BLAKE2b-256 |
6cd3b4fe423b3e000249b235294817de4d7063d8ac0a4400fcee89723167ee7c
|
Provenance
The following attestation bundles were made for pytrilogyt-0.0.20-py3-none-any.whl:
Publisher:
pythonpublish.yml on trilogy-data/pytrilogyt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytrilogyt-0.0.20-py3-none-any.whl -
Subject digest:
d033ca095f20b1ea4a6bb69d8ad375ec48662609eadb3898e2f5518e1a48ee5e - Sigstore transparency entry: 771196134
- Sigstore integration time:
-
Permalink:
trilogy-data/pytrilogyt@7c52e06bef048e1f2e064d5e2b555a8084ee57ad -
Branch / Tag:
refs/heads/main - Owner: https://github.com/trilogy-data
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pythonpublish.yml@7c52e06bef048e1f2e064d5e2b555a8084ee57ad -
Trigger Event:
push
-
Statement type: