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