pytrilogy 0.3.148__cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- LICENSE.md +19 -0
- _preql_import_resolver/__init__.py +5 -0
- _preql_import_resolver/_preql_import_resolver.cpython-312-aarch64-linux-gnu.so +0 -0
- pytrilogy-0.3.148.dist-info/METADATA +555 -0
- pytrilogy-0.3.148.dist-info/RECORD +206 -0
- pytrilogy-0.3.148.dist-info/WHEEL +5 -0
- pytrilogy-0.3.148.dist-info/entry_points.txt +2 -0
- pytrilogy-0.3.148.dist-info/licenses/LICENSE.md +19 -0
- trilogy/__init__.py +27 -0
- trilogy/ai/README.md +10 -0
- trilogy/ai/__init__.py +19 -0
- trilogy/ai/constants.py +92 -0
- trilogy/ai/conversation.py +107 -0
- trilogy/ai/enums.py +7 -0
- trilogy/ai/execute.py +50 -0
- trilogy/ai/models.py +34 -0
- trilogy/ai/prompts.py +100 -0
- trilogy/ai/providers/__init__.py +0 -0
- trilogy/ai/providers/anthropic.py +106 -0
- trilogy/ai/providers/base.py +24 -0
- trilogy/ai/providers/google.py +146 -0
- trilogy/ai/providers/openai.py +89 -0
- trilogy/ai/providers/utils.py +68 -0
- trilogy/authoring/README.md +3 -0
- trilogy/authoring/__init__.py +148 -0
- trilogy/constants.py +119 -0
- trilogy/core/README.md +52 -0
- trilogy/core/__init__.py +0 -0
- trilogy/core/constants.py +6 -0
- trilogy/core/enums.py +454 -0
- trilogy/core/env_processor.py +239 -0
- trilogy/core/environment_helpers.py +320 -0
- trilogy/core/ergonomics.py +193 -0
- trilogy/core/exceptions.py +123 -0
- trilogy/core/functions.py +1240 -0
- trilogy/core/graph_models.py +142 -0
- trilogy/core/internal.py +85 -0
- trilogy/core/models/__init__.py +0 -0
- trilogy/core/models/author.py +2662 -0
- trilogy/core/models/build.py +2603 -0
- trilogy/core/models/build_environment.py +165 -0
- trilogy/core/models/core.py +506 -0
- trilogy/core/models/datasource.py +434 -0
- trilogy/core/models/environment.py +756 -0
- trilogy/core/models/execute.py +1213 -0
- trilogy/core/optimization.py +251 -0
- trilogy/core/optimizations/__init__.py +12 -0
- trilogy/core/optimizations/base_optimization.py +17 -0
- trilogy/core/optimizations/hide_unused_concept.py +47 -0
- trilogy/core/optimizations/inline_datasource.py +102 -0
- trilogy/core/optimizations/predicate_pushdown.py +245 -0
- trilogy/core/processing/README.md +94 -0
- trilogy/core/processing/READMEv2.md +121 -0
- trilogy/core/processing/VIRTUAL_UNNEST.md +30 -0
- trilogy/core/processing/__init__.py +0 -0
- trilogy/core/processing/concept_strategies_v3.py +508 -0
- trilogy/core/processing/constants.py +15 -0
- trilogy/core/processing/discovery_node_factory.py +451 -0
- trilogy/core/processing/discovery_utility.py +548 -0
- trilogy/core/processing/discovery_validation.py +167 -0
- trilogy/core/processing/graph_utils.py +43 -0
- trilogy/core/processing/node_generators/README.md +9 -0
- trilogy/core/processing/node_generators/__init__.py +31 -0
- trilogy/core/processing/node_generators/basic_node.py +160 -0
- trilogy/core/processing/node_generators/common.py +270 -0
- trilogy/core/processing/node_generators/constant_node.py +38 -0
- trilogy/core/processing/node_generators/filter_node.py +315 -0
- trilogy/core/processing/node_generators/group_node.py +213 -0
- trilogy/core/processing/node_generators/group_to_node.py +117 -0
- trilogy/core/processing/node_generators/multiselect_node.py +207 -0
- trilogy/core/processing/node_generators/node_merge_node.py +695 -0
- trilogy/core/processing/node_generators/recursive_node.py +88 -0
- trilogy/core/processing/node_generators/rowset_node.py +165 -0
- trilogy/core/processing/node_generators/select_helpers/__init__.py +0 -0
- trilogy/core/processing/node_generators/select_helpers/datasource_injection.py +261 -0
- trilogy/core/processing/node_generators/select_merge_node.py +786 -0
- trilogy/core/processing/node_generators/select_node.py +95 -0
- trilogy/core/processing/node_generators/synonym_node.py +98 -0
- trilogy/core/processing/node_generators/union_node.py +91 -0
- trilogy/core/processing/node_generators/unnest_node.py +182 -0
- trilogy/core/processing/node_generators/window_node.py +201 -0
- trilogy/core/processing/nodes/README.md +28 -0
- trilogy/core/processing/nodes/__init__.py +179 -0
- trilogy/core/processing/nodes/base_node.py +522 -0
- trilogy/core/processing/nodes/filter_node.py +75 -0
- trilogy/core/processing/nodes/group_node.py +194 -0
- trilogy/core/processing/nodes/merge_node.py +420 -0
- trilogy/core/processing/nodes/recursive_node.py +46 -0
- trilogy/core/processing/nodes/select_node_v2.py +242 -0
- trilogy/core/processing/nodes/union_node.py +53 -0
- trilogy/core/processing/nodes/unnest_node.py +62 -0
- trilogy/core/processing/nodes/window_node.py +56 -0
- trilogy/core/processing/utility.py +823 -0
- trilogy/core/query_processor.py +604 -0
- trilogy/core/statements/README.md +35 -0
- trilogy/core/statements/__init__.py +0 -0
- trilogy/core/statements/author.py +536 -0
- trilogy/core/statements/build.py +0 -0
- trilogy/core/statements/common.py +20 -0
- trilogy/core/statements/execute.py +155 -0
- trilogy/core/table_processor.py +66 -0
- trilogy/core/utility.py +8 -0
- trilogy/core/validation/README.md +46 -0
- trilogy/core/validation/__init__.py +0 -0
- trilogy/core/validation/common.py +161 -0
- trilogy/core/validation/concept.py +146 -0
- trilogy/core/validation/datasource.py +227 -0
- trilogy/core/validation/environment.py +73 -0
- trilogy/core/validation/fix.py +256 -0
- trilogy/dialect/__init__.py +32 -0
- trilogy/dialect/base.py +1431 -0
- trilogy/dialect/bigquery.py +314 -0
- trilogy/dialect/common.py +147 -0
- trilogy/dialect/config.py +159 -0
- trilogy/dialect/dataframe.py +50 -0
- trilogy/dialect/duckdb.py +376 -0
- trilogy/dialect/enums.py +149 -0
- trilogy/dialect/metadata.py +173 -0
- trilogy/dialect/mock.py +190 -0
- trilogy/dialect/postgres.py +117 -0
- trilogy/dialect/presto.py +110 -0
- trilogy/dialect/results.py +89 -0
- trilogy/dialect/snowflake.py +129 -0
- trilogy/dialect/sql_server.py +137 -0
- trilogy/engine.py +48 -0
- trilogy/execution/__init__.py +17 -0
- trilogy/execution/config.py +119 -0
- trilogy/execution/state/__init__.py +0 -0
- trilogy/execution/state/file_state_store.py +0 -0
- trilogy/execution/state/sqllite_state_store.py +0 -0
- trilogy/execution/state/state_store.py +301 -0
- trilogy/executor.py +656 -0
- trilogy/hooks/__init__.py +4 -0
- trilogy/hooks/base_hook.py +40 -0
- trilogy/hooks/graph_hook.py +135 -0
- trilogy/hooks/query_debugger.py +166 -0
- trilogy/metadata/__init__.py +0 -0
- trilogy/parser.py +10 -0
- trilogy/parsing/README.md +21 -0
- trilogy/parsing/__init__.py +0 -0
- trilogy/parsing/common.py +1069 -0
- trilogy/parsing/config.py +5 -0
- trilogy/parsing/exceptions.py +8 -0
- trilogy/parsing/helpers.py +1 -0
- trilogy/parsing/parse_engine.py +2863 -0
- trilogy/parsing/render.py +773 -0
- trilogy/parsing/trilogy.lark +544 -0
- trilogy/py.typed +0 -0
- trilogy/render.py +45 -0
- trilogy/scripts/README.md +9 -0
- trilogy/scripts/__init__.py +0 -0
- trilogy/scripts/agent.py +41 -0
- trilogy/scripts/agent_info.py +306 -0
- trilogy/scripts/common.py +430 -0
- trilogy/scripts/dependency/Cargo.lock +617 -0
- trilogy/scripts/dependency/Cargo.toml +39 -0
- trilogy/scripts/dependency/README.md +131 -0
- trilogy/scripts/dependency/build.sh +25 -0
- trilogy/scripts/dependency/src/directory_resolver.rs +387 -0
- trilogy/scripts/dependency/src/lib.rs +16 -0
- trilogy/scripts/dependency/src/main.rs +770 -0
- trilogy/scripts/dependency/src/parser.rs +435 -0
- trilogy/scripts/dependency/src/preql.pest +208 -0
- trilogy/scripts/dependency/src/python_bindings.rs +311 -0
- trilogy/scripts/dependency/src/resolver.rs +716 -0
- trilogy/scripts/dependency/tests/base.preql +3 -0
- trilogy/scripts/dependency/tests/cli_integration.rs +377 -0
- trilogy/scripts/dependency/tests/customer.preql +6 -0
- trilogy/scripts/dependency/tests/main.preql +9 -0
- trilogy/scripts/dependency/tests/orders.preql +7 -0
- trilogy/scripts/dependency/tests/test_data/base.preql +9 -0
- trilogy/scripts/dependency/tests/test_data/consumer.preql +1 -0
- trilogy/scripts/dependency.py +323 -0
- trilogy/scripts/display.py +555 -0
- trilogy/scripts/environment.py +59 -0
- trilogy/scripts/fmt.py +32 -0
- trilogy/scripts/ingest.py +472 -0
- trilogy/scripts/ingest_helpers/__init__.py +1 -0
- trilogy/scripts/ingest_helpers/foreign_keys.py +123 -0
- trilogy/scripts/ingest_helpers/formatting.py +93 -0
- trilogy/scripts/ingest_helpers/typing.py +161 -0
- trilogy/scripts/init.py +105 -0
- trilogy/scripts/parallel_execution.py +748 -0
- trilogy/scripts/plan.py +189 -0
- trilogy/scripts/refresh.py +106 -0
- trilogy/scripts/run.py +79 -0
- trilogy/scripts/serve.py +202 -0
- trilogy/scripts/serve_helpers/__init__.py +41 -0
- trilogy/scripts/serve_helpers/file_discovery.py +142 -0
- trilogy/scripts/serve_helpers/index_generation.py +206 -0
- trilogy/scripts/serve_helpers/models.py +38 -0
- trilogy/scripts/single_execution.py +131 -0
- trilogy/scripts/testing.py +129 -0
- trilogy/scripts/trilogy.py +75 -0
- trilogy/std/__init__.py +0 -0
- trilogy/std/color.preql +3 -0
- trilogy/std/date.preql +13 -0
- trilogy/std/display.preql +18 -0
- trilogy/std/geography.preql +22 -0
- trilogy/std/metric.preql +15 -0
- trilogy/std/money.preql +67 -0
- trilogy/std/net.preql +14 -0
- trilogy/std/ranking.preql +7 -0
- trilogy/std/report.preql +5 -0
- trilogy/std/semantic.preql +6 -0
- trilogy/utility.py +34 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
"""Agent info command - outputs AGENTS.md-style usage guide for AI agents."""
|
|
2
|
+
|
|
3
|
+
from click import pass_context
|
|
4
|
+
|
|
5
|
+
from trilogy.ai.prompts import get_trilogy_prompt
|
|
6
|
+
|
|
7
|
+
AGENT_INFO_OUTPUT = """# Trilogy CLI - AI Agent Usage Guide
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
Trilogy is a semantic ETL and reporting tool providing a SQL-like language with
|
|
12
|
+
optimizations. This CLI enables workspace management, script execution, testing,
|
|
13
|
+
and data ingestion.
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Initialize a new workspace
|
|
19
|
+
trilogy init [path]
|
|
20
|
+
|
|
21
|
+
# Run a script
|
|
22
|
+
trilogy run script.preql dialect [connection_args...]
|
|
23
|
+
|
|
24
|
+
# Run unit tests (mocked datasources)
|
|
25
|
+
trilogy unit script.preql
|
|
26
|
+
|
|
27
|
+
# Run integration tests (real connections)
|
|
28
|
+
trilogy integration script.preql dialect [connection_args...]
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Commands Reference
|
|
32
|
+
|
|
33
|
+
### trilogy init [path]
|
|
34
|
+
|
|
35
|
+
Create a new Trilogy workspace with default configuration and structure.
|
|
36
|
+
|
|
37
|
+
**Arguments:**
|
|
38
|
+
- `path` (optional): Directory to initialize (default: current directory)
|
|
39
|
+
|
|
40
|
+
**Creates:**
|
|
41
|
+
- `trilogy.toml` - Configuration file
|
|
42
|
+
- `raw/` - Directory for raw data models
|
|
43
|
+
- `derived/` - Directory for derived data models
|
|
44
|
+
- `jobs/` - Directory for job scripts
|
|
45
|
+
- `hello_world.preql` - Example script
|
|
46
|
+
|
|
47
|
+
**Example:**
|
|
48
|
+
```bash
|
|
49
|
+
trilogy init my_project
|
|
50
|
+
cd my_project
|
|
51
|
+
trilogy unit hello_world.preql
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
### trilogy run <input> [dialect] [options] [conn_args...]
|
|
57
|
+
|
|
58
|
+
Execute a Trilogy script or all scripts in a directory.
|
|
59
|
+
|
|
60
|
+
**Arguments:**
|
|
61
|
+
- `input` (required): Path to .preql file or directory
|
|
62
|
+
- `dialect` (optional): Database dialect (duckdb, postgres, snowflake, bigquery, etc.)
|
|
63
|
+
- `conn_args` (optional): Connection arguments passed to the database driver
|
|
64
|
+
|
|
65
|
+
**Options:**
|
|
66
|
+
- `--param KEY=VALUE`: Environment parameters (can be repeated)
|
|
67
|
+
- `--parallelism N`, `-p N`: Max parallel workers for directory execution
|
|
68
|
+
- `--config PATH`: Path to trilogy.toml configuration file
|
|
69
|
+
|
|
70
|
+
**Examples:**
|
|
71
|
+
```bash
|
|
72
|
+
# Run single script with DuckDB
|
|
73
|
+
trilogy run query.preql duckdb
|
|
74
|
+
|
|
75
|
+
# Run with connection string
|
|
76
|
+
trilogy run etl.preql postgres "postgresql://user:pass@host/db"
|
|
77
|
+
|
|
78
|
+
# Run directory with parallelism
|
|
79
|
+
trilogy run jobs/ duckdb -p 4
|
|
80
|
+
|
|
81
|
+
# Run with parameters
|
|
82
|
+
trilogy run report.preql duckdb --param date=2024-01-01 --param region=US
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
### trilogy unit <input> [options]
|
|
88
|
+
|
|
89
|
+
Run unit tests on Trilogy scripts with mocked datasources. Always uses DuckDB.
|
|
90
|
+
|
|
91
|
+
**Arguments:**
|
|
92
|
+
- `input` (required): Path to .preql file or directory
|
|
93
|
+
|
|
94
|
+
**Options:**
|
|
95
|
+
- `--param KEY=VALUE`: Environment parameters
|
|
96
|
+
- `--parallelism N`, `-p N`: Max parallel workers
|
|
97
|
+
- `--config PATH`: Path to trilogy.toml
|
|
98
|
+
|
|
99
|
+
**Examples:**
|
|
100
|
+
```bash
|
|
101
|
+
# Test single file
|
|
102
|
+
trilogy unit test_query.preql
|
|
103
|
+
|
|
104
|
+
# Test entire directory
|
|
105
|
+
trilogy unit tests/ -p 4
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
### trilogy integration <input> [dialect] [options] [conn_args...]
|
|
111
|
+
|
|
112
|
+
Run integration tests on Trilogy scripts with real database connections. Integration tests
|
|
113
|
+
run validation that all datasources are configured properly. They do not execute code.
|
|
114
|
+
|
|
115
|
+
To set up new tables, run first then do integration.
|
|
116
|
+
|
|
117
|
+
**Arguments:**
|
|
118
|
+
- `input` (required): Path to .preql file or directory
|
|
119
|
+
- `dialect` (optional): Database dialect
|
|
120
|
+
- `conn_args` (optional): Connection arguments
|
|
121
|
+
|
|
122
|
+
**Options:**
|
|
123
|
+
- `--param KEY=VALUE`: Environment parameters
|
|
124
|
+
- `--parallelism N`, `-p N`: Max parallel workers
|
|
125
|
+
- `--config PATH`: Path to trilogy.toml
|
|
126
|
+
|
|
127
|
+
**Examples:**
|
|
128
|
+
```bash
|
|
129
|
+
# Integration test against Postgres
|
|
130
|
+
trilogy integration tests/ postgres "postgresql://localhost/testdb"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
### trilogy fmt <input>
|
|
136
|
+
|
|
137
|
+
Format a Trilogy script file.
|
|
138
|
+
|
|
139
|
+
**Arguments:**
|
|
140
|
+
- `input` (required): Path to .preql file to format
|
|
141
|
+
|
|
142
|
+
**Example:**
|
|
143
|
+
```bash
|
|
144
|
+
trilogy fmt messy_script.preql
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
### trilogy ingest <tables> [dialect] [options] [conn_args...]
|
|
150
|
+
|
|
151
|
+
Bootstrap datasources from existing warehouse tables. Connects to a database,
|
|
152
|
+
introspects table schemas, and generates Trilogy datasource definitions.
|
|
153
|
+
|
|
154
|
+
**Arguments:**
|
|
155
|
+
- `tables` (required): Comma-separated list of table names
|
|
156
|
+
- `dialect` (optional): Database dialect
|
|
157
|
+
- `conn_args` (optional): Connection arguments
|
|
158
|
+
|
|
159
|
+
**Options:**
|
|
160
|
+
- `--output PATH`, `-o PATH`: Output directory for generated files
|
|
161
|
+
- `--schema NAME`, `-s NAME`: Schema/database to ingest from
|
|
162
|
+
- `--config PATH`: Path to trilogy.toml
|
|
163
|
+
- `--fks SPEC`: Foreign key relationships (format: table.col:ref_table.col)
|
|
164
|
+
|
|
165
|
+
**Examples:**
|
|
166
|
+
```bash
|
|
167
|
+
# Ingest tables from DuckDB
|
|
168
|
+
trilogy ingest "users,orders,products" duckdb "path/to/db.duckdb"
|
|
169
|
+
|
|
170
|
+
# Ingest with schema and output directory
|
|
171
|
+
trilogy ingest "customers" postgres -s public -o raw/ "postgresql://localhost/db"
|
|
172
|
+
|
|
173
|
+
# Ingest with foreign key relationships
|
|
174
|
+
trilogy ingest "orders,customers" duckdb --fks "orders.customer_id:customers.id"
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
### trilogy serve <directory> [engine] [options]
|
|
180
|
+
|
|
181
|
+
Start a FastAPI server to expose Trilogy models from a directory.
|
|
182
|
+
Requires `pytrilogy[serve]` extras.
|
|
183
|
+
|
|
184
|
+
**Arguments:**
|
|
185
|
+
- `directory` (required): Directory containing model files
|
|
186
|
+
- `engine` (optional): Engine type (default: generic)
|
|
187
|
+
|
|
188
|
+
**Options:**
|
|
189
|
+
- `--port N`, `-p N`: Port number (default: 8100)
|
|
190
|
+
- `--host HOST`, `-h HOST`: Host to bind (default: 0.0.0.0)
|
|
191
|
+
- `--timeout N`, `-t N`: Shutdown after N seconds
|
|
192
|
+
|
|
193
|
+
**Endpoints exposed:**
|
|
194
|
+
- `/` - Server info
|
|
195
|
+
- `/index.json` - List of available models
|
|
196
|
+
- `/models/<name>.json` - Specific model details
|
|
197
|
+
- `/files/<name>` - Raw .preql/.sql file content
|
|
198
|
+
|
|
199
|
+
**Example:**
|
|
200
|
+
```bash
|
|
201
|
+
trilogy serve ./models/ duckdb --port 8080
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
### trilogy agent <command> [options]
|
|
207
|
+
|
|
208
|
+
Pass off a multi-step orchestration task to an AI agent. (Not yet implemented)
|
|
209
|
+
|
|
210
|
+
**Arguments:**
|
|
211
|
+
- `command` (required): Natural language command
|
|
212
|
+
|
|
213
|
+
**Options:**
|
|
214
|
+
- `--context PATH`, `-c PATH`: Additional context files
|
|
215
|
+
- `--model NAME`, `-m NAME`: AI model to use
|
|
216
|
+
- `--interactive`, `-i`: Interactive mode with feedback
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Configuration File (trilogy.toml)
|
|
221
|
+
|
|
222
|
+
```toml
|
|
223
|
+
[engine]
|
|
224
|
+
# Default dialect for execution
|
|
225
|
+
dialect = "duckdb"
|
|
226
|
+
|
|
227
|
+
# Max parallelism for multi-script execution
|
|
228
|
+
parallelism = 3
|
|
229
|
+
|
|
230
|
+
[setup]
|
|
231
|
+
# Startup scripts to run before execution
|
|
232
|
+
trilogy = ["setup.preql"]
|
|
233
|
+
sql = ["init.sql"]
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Supported Dialects
|
|
237
|
+
|
|
238
|
+
- `duckdb` / `duck_db` - DuckDB (default for unit tests)
|
|
239
|
+
- `postgres` / `postgresql` - PostgreSQL
|
|
240
|
+
- `bigquery` - Google BigQuery
|
|
241
|
+
- `snowflake` - Snowflake
|
|
242
|
+
- `redshift` - Amazon Redshift
|
|
243
|
+
- `trino` - Trino/Presto
|
|
244
|
+
- `sql_server` - Microsoft SQL Server
|
|
245
|
+
|
|
246
|
+
## File Types
|
|
247
|
+
|
|
248
|
+
- `.preql` - Trilogy script files (main language)
|
|
249
|
+
- `.sql` - Raw SQL files (for setup scripts)
|
|
250
|
+
- `trilogy.toml` - Configuration file
|
|
251
|
+
|
|
252
|
+
## Common Workflows
|
|
253
|
+
|
|
254
|
+
### 1. Setting up a new project
|
|
255
|
+
```bash
|
|
256
|
+
trilogy init my_analytics
|
|
257
|
+
cd my_analytics
|
|
258
|
+
# Configure trilogy.toml with your dialect and connection
|
|
259
|
+
trilogy unit hello_world.preql
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### 2. Ingesting existing tables
|
|
263
|
+
```bash
|
|
264
|
+
trilogy ingest "fact_sales,dim_customers,dim_products" postgres \\
|
|
265
|
+
-s analytics -o raw/ "postgresql://localhost/warehouse"
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### 3. Running ETL jobs
|
|
269
|
+
```bash
|
|
270
|
+
trilogy run jobs/ postgres -p 4 "postgresql://localhost/warehouse"
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### 4. Testing before deployment
|
|
274
|
+
```bash
|
|
275
|
+
# Unit tests (fast, no connection needed)
|
|
276
|
+
trilogy unit .
|
|
277
|
+
|
|
278
|
+
# Integration tests (real connection)
|
|
279
|
+
trilogy integration . postgres "postgresql://localhost/testdb"
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## Debug Mode
|
|
283
|
+
|
|
284
|
+
Add `--debug` flag to any command for verbose output:
|
|
285
|
+
```bash
|
|
286
|
+
trilogy --debug run query.preql duckdb
|
|
287
|
+
```
|
|
288
|
+
"""
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
def get_agent_info_output() -> str:
|
|
292
|
+
"""Build the complete agent info output with CLI docs and syntax reference."""
|
|
293
|
+
syntax_section = get_trilogy_prompt(
|
|
294
|
+
intro="## Trilogy Language Syntax\n\nTrilogy is a SQL-inspired language with a built-in semantic layer. Use the following syntax reference when writing .preql files.",
|
|
295
|
+
)
|
|
296
|
+
return AGENT_INFO_OUTPUT + "\n" + syntax_section
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
@pass_context
|
|
300
|
+
def agent_info(ctx):
|
|
301
|
+
"""Output comprehensive CLI documentation for AI agents.
|
|
302
|
+
|
|
303
|
+
Prints an AGENTS.md-style guide with all commands, options,
|
|
304
|
+
and usage examples optimized for AI agent consumption.
|
|
305
|
+
"""
|
|
306
|
+
print(get_agent_info_output())
|