Looking for the previous version? View v2024.06 documentation →
Using Variables in Queries
Overview
Variables in Query Studio allow you to create dynamic SQL queries that accept parameter values at execution time. Predefined system variables (such as current date) and user-defined variables can be referenced within query expressions using the Variables panel.
Prerequisites
- You are logged in to Data Trust with a Pro-User or Admin Pro-User role.
- A query has been created and at least one user-defined variable exists in the system.
Steps
Path: Data Trust › Query Studio › Using Variables in Queries
The Query builder is the main workspace for building and editing queries. Use the canvas to write SQL, add data sources, connect transformations, and configure output options.
Select the appropriate connection profile from the dropdown to link the query to its data source. Choosing the correct profile ensures the query reads from the intended database or system.
This step shows write a query in the Using Variables in Queries workflow. Follow the on-screen prompts to complete this configuration step before proceeding to the next stage.
The Variables panel lists all predefined system variables and user-defined variables available for use in queries. Select a variable to insert it into the query expression, making the query dynamic and reusable across executions.
The Variables panel lists all predefined system variables and user-defined variables available for use in queries. Select a variable to insert it into the query expression, making the query dynamic and reusable across executions.
This step shows test result in the Using Variables in Queries workflow. Follow the on-screen prompts to complete this configuration step before proceeding to the next stage.
Click Execute Now to run the query immediately and fetch the result set. The results appear in the Results tab, and the execution status is displayed in the progress indicator.
The results displays the output data returned by the query or Query Chain execution. Review row counts, column values, and data quality before saving or using the output in downstream processes.