Standard parameter syntax
In Coginiti, you can apply various parameters in the queries:
- To do so, insert the $symbol in any part of your SQL statement.
- When you execute a query, the application will ask you to fill in a parameter's value before sending a query to a database.
1 --sample parameter query
2
3 select *
4 from landing_dim_customer
5 where gender = $fill_in_gender_at_runtime
6 limit 100;
- The application will provide you with the following data type at runtime:
Parameter Data Type |
Action Taken |
As Is |
Coginiti will send entered value exactly as written, with no casting. This feature often helps when you use a parameter to fill in the database table or column names. |
- You can specify default values by using this syntax with your parameters:
$fill_in_gender_at_runtime{‘M’}
When you run a query with all your parameters, you'll see the little gear icon as shown below. Click on it to populate the default value if needed.
🔎 Note: If you're using a column with the text format, please, keep in mind that you need to add ‘’ or “” symbols into the designated field in the Run query with parameters pop-up.
Alternative parameter syntax
We are pleased to announce that starting from Coginiti v22.02, we support an alternative parameter syntax so that you can specify both, parameters and session variables in the queries:
- Select $$<name> in settings:
- Type a query:
SET (MIN, MAX)=(5.0, 499.99);
SELECT AVG(TOTAL_PRICE) from ORDERS
WHERE TOTAL_PRICE BETWEEN $MIN AND $MAX
AND PAYMENT_CURRENCY = $$currency{'EUR'}; - Execute the query and fill in the parameter’s value:
🔎 Note: You only need to specify the value of $$currency as it is a parameter. The session variables MIN and MAX are set in the 1st line.
- Get the result: