@@ -61,7 +61,7 @@ While not officially supported yet, you can work around for other data types via
61
61
To convert a parameter to a specific type, use the ` :: ` syntax followed by the type name:
62
62
63
63
``` sql
64
- ${lightdash .parameters .parameter_name::type}
64
+ ${lightdash .parameters .parameter_name} ::type
65
65
```
66
66
67
67
<Note >
@@ -74,10 +74,10 @@ As a workaround, you can use `::date` for dates or `::timestamp` for datetime va
74
74
75
75
``` sql
76
76
-- Convert to date (workaround)
77
- WHERE ${TABLE}.order_date >= ${lightdash .parameters .start_date::date }
77
+ WHERE ${TABLE}.order_date >= ${lightdash .parameters .start_date} ::date
78
78
79
79
-- Convert to timestamp (workaround)
80
- WHERE ${TABLE}.created_at >= ${lightdash .parameters .start_datetime::timestamp }
80
+ WHERE ${TABLE}.created_at >= ${lightdash .parameters .start_datetime} ::timestamp
81
81
```
82
82
83
83
#### Boolean conversion
@@ -86,7 +86,7 @@ As a workaround, you can use `::boolean` to convert string values like "true"/"f
86
86
87
87
``` sql
88
88
-- Convert to boolean (workaround)
89
- WHERE ${TABLE}.is_active = ${lightdash .parameters .active_only::boolean }
89
+ WHERE ${TABLE}.is_active = ${lightdash .parameters .active_only} ::boolean
90
90
```
91
91
92
92
#### Other type conversions
@@ -95,8 +95,8 @@ You can use any SQL type conversion that your database supports:
95
95
96
96
``` sql
97
97
-- Convert to specific database types
98
- WHERE ${TABLE}.category_id = ${lightdash .parameters .category::uuid}
99
- WHERE ${TABLE}.amount = ${lightdash .parameters .amount::decimal (10 ,2 )}
98
+ WHERE ${TABLE}.category_id = ${lightdash .parameters .category} ::uuid
99
+ WHERE ${TABLE}.amount = ${lightdash .parameters .amount} ::decimal (10 ,2 )
100
100
```
101
101
102
102
## How to reference parameters in SQL
0 commit comments