Skip to main content

Enhanced Trilogy for common ETL needs.

Project description

Simple Declarative Data Pipelines

Combine the simplicity of Trilogy with the modern data stack such as DBT.

[!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:

  • Native (optimize a PreQL model)
  • DBT

[!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

preqlt <preql_path> <output_path> --run

DBT

For dbt, the output_path should be the root of the dbt project, where the dbt_project.yml file exists.

trilogyt dbt/models/core/ ./dbt bigquery --run

Each source preql file will be built into a separate DBT sub folder with one model per persist statement.

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

From IO

Write-Output """constant x <-5; persist into static as static select x;""" | trilogyt <output_path> bigquery

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytrilogyt-0.0.10.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

pytrilogyt-0.0.10-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file pytrilogyt-0.0.10.tar.gz.

File metadata

  • Download URL: pytrilogyt-0.0.10.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pytrilogyt-0.0.10.tar.gz
Algorithm Hash digest
SHA256 be98c7f211d9306c312c1033b5cdcdbbb1746960e28e2c4c9cbb1c264bb9c1d6
MD5 e4d29c4f09b4e353f7ecd74fff7c2fdd
BLAKE2b-256 0558c925ddfb225d8e5d1feadf5d8619d4d4a4f273108a4fd6cf5d3fa6acec3d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytrilogyt-0.0.10.tar.gz:

Publisher: pythonpublish.yml on trilogy-data/pytrilogyt

Attestations:

File details

Details for the file pytrilogyt-0.0.10-py3-none-any.whl.

File metadata

  • Download URL: pytrilogyt-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pytrilogyt-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 b07854b20b65336ae8c27337a7a83abb0508168af210d1685ea5f10d3d25807c
MD5 303d94de4b4fda449554717ffb8bcb63
BLAKE2b-256 4667ed2c44e8b03851850a1d6a40f1437c3c8e42e535a70868ca52cb53f6a1f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytrilogyt-0.0.10-py3-none-any.whl:

Publisher: pythonpublish.yml on trilogy-data/pytrilogyt

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page