Files
triggerdotdev--trigger.dev/internal-packages/tsql
Matt Aitken 9942518e49 TRQL/Query improvements (#2870)
Summary
- Improve query experience and safety across ClickHouse and TSQL.

Changes
- Display JSON columns when in non-pretty mode (no longer show [Object
Object]).
- Sanitize ClickHouse errors originating from TSQL.
- Remove tenant details from errors.
- Add AI-assisted error-fixing for queries.
- Improve code quality and readability.
- Provide autocomplete support for enum values.
- Enforce limits on ClickHouse queries (10s query limit).
- Add org-level and global concurrency limits.
- Warn and train AI to avoid SELECT *; when used, only return core
columns and show info.
- If AI suggests no time range, default to past 7 days.
- Format the default query for readability.
- Add an admin-only EXPLAIN button.
- Prevent impersonation queries from being saved to history.
2026-01-13 11:12:15 +00:00
..
2026-01-13 11:12:15 +00:00
2026-01-09 11:39:36 +00:00
2026-01-09 11:39:36 +00:00
2026-01-09 11:39:36 +00:00
2026-01-09 11:39:36 +00:00
2026-01-09 11:39:36 +00:00

TSQL (TriggerSQL)

TriggerSQL is a DSL that is safely converted into ClickHouse SQL queries with protection against SQL injection and it's tenant-safe (users can only query their own data).

Attribution

This package is derived from PostHog's HogQL (MIT License). See NOTICE.md for the full copyright notice.

ANTLR Grammar

The ANTLR grammar is heavily inspired by PostHog's HogQL.

These are found in ./src/grammar and are the .g4 files.

Generating the source code

pnpm run grammar:build