Variables
Define named variables in tpaw to parameterize SQL queries with substitution syntax.
Variables let you define named key-value pairs that are substituted into your SQL queries at runtime. Use ${variable_name} in a query and tpaw replaces it with the variable's current value before executing. This is useful for queries you run repeatedly with different inputs — user IDs, date ranges, status values, and similar parameters.
Variable types
| Type | Behavior | Use for |
|---|---|---|
| Text | Value is escaped and quoted as a SQL string literal | Names, statuses, string filters |
| Raw | Value is inserted as-is, without quoting or escaping | Numeric values, SQL fragments, identifiers |
Text variables are safe by default — tpaw properly escapes the value, so injection is not a concern. Raw variables give you full control but require you to ensure the value is safe SQL.
Using variables in queries
Reference a variable in any SQL query with ${name}:
Managing variables
Open the Variables panel from the sidebar navigation. The panel shows all defined variables grouped by type (Text and Raw), with a search bar and type filter.
Creating a variable
Click the + button to open the variable editor modal. Enter:
- Name — the identifier used in
${name}syntax - Value — the substitution value
- Type — Text (escaped) or Raw (literal)
Click Save to create the variable.
Editing a variable
Click any variable row in the Variables panel to open the edit modal. Update the name, value, or type and click Save.
Deleting a variable
Hover over a variable row and click the trash icon to delete it.
Variables are per-connection
Each database connection has its own variable store. Variables do not carry over between connections.