Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

docs: parameters type #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
ZeRego merged 2 commits into main from parameters-type
Aug 26, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions guides/using-parameters.mdx
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,61 @@ Parameters can be referenced in many places throughout your Lightdash project:
7. **Additional Dimensions**: Use parameters in the SQL definition of an [additional dimension](/references/dimensions#additional-dimensions)
8. **Custom Dimensions**: Use parameters in [custom dimension](/references/custom-fields#custom-sql) definitions

## Parameter types

Parameters in Lightdash support different data types to help you work with various kinds of data. By default, all parameters are treated as strings, but you can convert them to other types as needed.

### Supported parameter types

Lightdash officially supports the following parameter types:

- **String** (default): Text values
- **Number**: Numeric values (integers and decimals)

### Type conversion workarounds

While not officially supported yet, you can work around for other data types via SQL type casting.
To convert a parameter to a specific type, use the `::` syntax followed by the type name:

```sql
${lightdash.parameters.parameter_name}::type
```

<Note>
The type conversion happens at the SQL level, so the available types depend on your database system (PostgreSQL, BigQuery, Snowflake, etc.). Common types like `integer`, `numeric`, `date`, `timestamp`, and `boolean` are supported across most databases.
</Note>

#### Date conversion

As a workaround, you can use `::date` for dates or `::timestamp` for datetime values:

```sql
-- Convert to date (workaround)
WHERE ${TABLE}.order_date >= ${lightdash.parameters.start_date}::date

-- Convert to timestamp (workaround)
WHERE ${TABLE}.created_at >= ${lightdash.parameters.start_datetime}::timestamp
```

#### Boolean conversion

As a workaround, you can use `::boolean` to convert string values like "true"/"false" to boolean:

```sql
-- Convert to boolean (workaround)
WHERE ${TABLE}.is_active = ${lightdash.parameters.active_only}::boolean
```

#### Other type conversions

You can use any SQL type conversion that your database supports:

```sql
-- Convert to specific database types
WHERE ${TABLE}.category_id = ${lightdash.parameters.category}::uuid
WHERE ${TABLE}.amount = ${lightdash.parameters.amount}::decimal(10,2)
```

## How to reference parameters in SQL

### Project-level parameters
Expand Down

AltStyle によって変換されたページ (->オリジナル) /