Guide

Add SQL variables to reusable queries

Define typed inputs with safe defaults so every Run Now and scheduled export uses the intended parameters. Variables keep queries reusable without copying SQL for each environment, date range, or customer.

Start free No credit card required. See the query workspace

Variables are available on Pro and Enterprise.

Define variables in the variables panel

Open the variables drawer from any query tab, click Add variable, and set a name, type, and default value. Prefer typed inputs (Select, Text, Number, Date) so teammates do not need to guess formatting.

Use variables inside SQL

Reference variables with double curly braces, for example: {{ start_date }}. DataPilot reuses the same definitions and defaults for both Run Now and scheduled exports.

Tip

Keep names stable (for example start_date, end_date, customer_id) so schedules stay reusable as queries evolve.