tessl install tessl/npm-lightdash--common@0.2231.5Shared TypeScript library for the Lightdash platform containing common types, utilities, and business logic for analytics workflows
Agent Success
Agent success rate when using this tile
72%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.09x
Baseline
Agent success rate without this tile
66%
Build a filter SQL compilation module that translates filter rules into SQL WHERE clauses for different data types. The system should handle string, number, date, and boolean filters with various operators, generating appropriate SQL for each filter type.
Implement a function that compiles string filter rules into SQL:
The function should accept: dimension SQL expression, filter rule with operator and values, and a string quote character for the target database.
Implement a function that compiles number filter rules into SQL:
Validate all numeric values and throw an error for invalid numbers (NaN or Infinity).
Implement a function that compiles date filter rules into SQL with warehouse-specific casting:
The function should handle warehouse-specific SQL generation. For Trino, dates should be wrapped with CAST('value' AS timestamp). For other warehouses, use quoted strings like ('value').
Implement a function that compiles boolean filter rules into SQL:
'true' to avoid filtering' for most, " for some)Provides filter compilation utilities and type definitions for the Lightdash BI platform.
Input:
users.email['example.com', 'test.org']'Expected SQL:
(LOWER(users.email) LIKE LOWER('%example.com%')
OR
LOWER(users.email) LIKE LOWER('%test.org%'))Input:
orders.amount[100, 500]Expected SQL:
(orders.amount) >= (100) AND (orders.amount) <= (500)Input:
orders.created_atExpected SQL:
(orders.created_at) > CAST('2023-01-01' AS timestamp)Input (same but different warehouse):
Expected SQL:
(orders.created_at) > ('2023-01-01')Input:
users.is_activetrueExpected SQL:
(users.is_active) = TRUEdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
scenario-11
scenario-12
scenario-13
scenario-14
scenario-15
scenario-16
scenario-17
scenario-18
scenario-19
scenario-20