Guide

Add SQL variables to reusable queries

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

Start free No credit card required. See the query workspace

Note: 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 don�t have to remember �the right format� when they run or schedule exports.

Screenshot placeholder

Add screenshot: variables drawer showing �Add variable�, types, and default value fields.

Screenshot needed

Screenshot needed: variables drawer with Add variable, type selector, and default value fields.

Sizes: 1600x900 hero + OG 1200x630; Alt: "SQL variables panel with types and defaults".

Use variables inside SQL

Reference variables with double curly braces (for example: {{ start_date }}). When you Run Now or schedule an export, DataPilot uses the same variable definitions and defaults so the query stays consistent across runs.

Tip

Keep variable names stable (e.g. start_date, end_date, customer_id) so schedules don�t need to be rebuilt when you refactor a query.

Plan gating and team consistency

Variables and shared defaults are part of Pro and Enterprise because they power team workflows: consistent reruns, repeatable schedules, and predictable exports. If you�re sharing results, pair variables with a schedule so teammates always download a file produced with the intended inputs.

Return to the workspace