modelerUpdated 2026-05-01

Parameterized Filters

What this covers

A parameterized filter is a named placeholder in a model's query predicates that is resolved to a concrete value at query time. This page explains what parameters are, when to use them, how to define them, how values are resolved, and how BI tools pass parameter values through JDBC session variables.

What parameters solve

Many analytical models include filters that vary by user, session, or audience — a region code, a date range, a product category. Without parameters, the modeller has three unsatisfying options: hard-code a default (inflexible), define separate models per filter value (duplication), or rely on downstream tools to append WHERE clauses (inconsistent).

Parameters give the modeller a single declaration point for each variable filter. The query engine resolves the value from the most authoritative source available, substitutes it into the SQL, and handles type-aware expansion (IN lists, BETWEEN ranges, quoted strings). The model stays clean; the variability moves to the parameter layer.

Parameter types

TypeValue shapeSQL expansion
stringA single text value= 'value'
numberA single numeric value= value
multi_valueA list of text valuesIN ('a', 'b', 'c')
date_rangeAn object with from and toBETWEEN 'from' AND 'to'
booleantrue or false= TRUE or = FALSE

Type validation happens at resolution time. A multi_value parameter supplied with a single string is auto-wrapped into a one-element list. A number parameter supplied with a non-numeric value fails with a clear error.

Defining a parameter

  1. Open a model in Model Builder.
  2. Click the Parameters icon in the toolbelt to open the Parameters panel.
  3. Click Add Parameter.
  4. Fill in:
  1. Click Save.

Parameters are unique per model by name. Attempting to create a duplicate name returns HTTP 409.

Resolution order

When a query references a parameter, the engine resolves its value using three sources, in order of precedence (highest first):

  1. Persona default filter. If the query is bound to a persona and that persona defines a default filter matching the parameter, the persona's value wins.
  2. JDBC session variable. If the BI tool set app.<param_name> via a SET command earlier in the session, that value is used.
  3. Model default value. The default defined on the parameter definition.

If no value is available from any source and the parameter has no default, the query fails with a structured error naming the unresolved parameter.

JDBC session variables

BI tools connected via JDBC (port 5433) can set parameter values per session using the standard PostgreSQL SET command:

SET app.region = 'APAC';
SET app.date_start = '2025-01-01';
SET app.date_end = '2025-12-31';

The app. prefix is required. Session variables persist for the lifetime of the JDBC connection and are cleared when the client disconnects.

This mechanism works with any PostgreSQL-compatible client: DBeaver, Tableau (custom SQL), psycopg2, JDBC drivers. The gateway captures the SET commands and passes the values to the query router as part of the query context.

Worked example

A modeller defines two parameters on the sales model:

NameTypeDefault
@regionstring"ALL"
@report_datedate_range{"from": "2025-01-01", "to": "2025-12-31"}

A DBeaver user connects and runs:

SET app.region = 'EMEA';
SELECT country, SUM(revenue) FROM sales WHERE region = @region GROUP BY country;

The query engine resolves @region to 'EMEA' (from the session variable, which takes precedence over the default). The @report_date parameter is not referenced in this query, so it is not resolved.

A different user connects via a persona that defines default_filters: {"region": "APAC"}. Their query:

SELECT country, SUM(revenue) FROM sales WHERE region = @region GROUP BY country;

The engine resolves @region to 'APAC' — the persona filter takes precedence over both the session variable (not set in this session) and the model default.

Editing and deleting parameters

Best practices

API reference

MethodEndpointPurpose
GET/api/v1/models/{model_id}/parametersList model parameters
POST/api/v1/models/{model_id}/parametersCreate a parameter
PUT/api/v1/models/{model_id}/parameters/{id}Update a parameter
DELETE/api/v1/models/{model_id}/parameters/{id}Delete a parameter

All require modeler role on the model's project.

Related