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 utility that compiles date range filters into warehouse-specific SQL WHERE clauses. The system should handle relative date filters with timezone support and generate SQL compatible with different database warehouses.
Your implementation should:
Accept filter configurations that specify:
Generate valid SQL WHERE clause expressions that:
Support at least these filter operators:
Export the compiled SQL as a string that can be used in a WHERE clause.
Compiling a filter for "timestamp_field in the past 7 days" with UTC timezone for BigQuery generates valid SQL with BigQuery-specific date functions @test
Compiling a filter for "date_field in the next 30 days" with America/New_York timezone for Postgres generates valid SQL with Postgres-specific date functions @test
Compiling a filter for "created_at in the current month" with UTC timezone for Snowflake generates SQL that checks if the field is within the current calendar month @test
@generates
export type FilterOperator =
| 'inThePast'
| 'inTheNext'
| 'inTheCurrent';
export type TimeUnit = 'day' | 'week' | 'month' | 'year';
export type WarehouseType = 'bigquery' | 'snowflake' | 'postgres' | 'redshift';
export interface DateFilterConfig {
fieldName: string;
operator: FilterOperator;
value: number;
unit: TimeUnit;
timezone: string;
warehouse: WarehouseType;
completed?: boolean; // For past/next filters: true = completed periods only, false = including current
}
export function compileDateFilter(config: DateFilterConfig): string;Provides filter compilation utilities and warehouse-specific SQL generation for date operations.
docs
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