Run
Run
The run command executes a Trilogy script or all scripts in a directory against a specified database.
Arguments:
@argument("input", type=Path())
@argument("dialect", type=str, required=False)
@option("--param", multiple=True, help="Environment parameters as key=value pairs")
@option("--parallelism", "-p", default=None, help="Maximum parallel workers for directory execution")
@option("--config", type=Path(exists=True), help="Path to trilogy.toml configuration file")
@argument("conn_args", nargs=-1, type=UNPROCESSED)
Supported Dialects
duckdb/duck_db- DuckDBpostgres/postgresql- PostgreSQLbigquery- Google BigQuerysnowflake- Snowflakeredshift- Amazon Redshifttrino- Trino/Prestosql_server- Microsoft SQL Server
Full Examples
# Run single script with DuckDB
trilogy run query.preql duckdb
# Run with connection string
trilogy run etl.preql postgres "postgresql://user:pass@host/db"
# Run directory with parallelism
trilogy run jobs/ duckdb -p 4
# Run with parameters
trilogy run report.preql duckdb --param date=2024-01-01 --param region=US
# Run with config file
trilogy run script.preql --config custom_config.toml
Notes
- When running a directory, scripts are executed in dependency order
- The
--parallelismoption controls how many scripts run concurrently - Parameters support automatic type conversion (true/false → boolean, numeric strings → numbers)
