CLI Quickstart
CLI Quickstart
Installation
pip install pytrilogy[cli]
You can now run Trilogy queries from the CLI:
trilogy run "SELECT 1 + 1->test;" duckdb
Creating Useful Projects
trilogy init <folder>
cd folder
trilogy exec hello_world.preql
This will bootstrap a project for you to work in. In the root of the repo is a trilogy.toml file.
This file can be edited to provide defaults to the CLI behavior (this is particularly useful for configuring connection info).
Import Existing Tables
trilogy ingest <table_name> <connection_info>
This will import a table definition into the raw sub folder. These will be default assumed to be 'roots', or tables that are not created/managed by trilogy.
Execute a new script
Write a new script, such as select 1 as hello_world_two;. Save it in your directory and run it.
trilogy exec <file/directory> <connection_info>
Interactively Query Your Model
trilogy serve <directory>
Will block and serve the directory as a web-service. You can then use the studio to connect to this as a model store, ingest the models and query them live. Great for development and debugging.
