Parameters

Data Access Token

Parameters are an optional way of providing signed values that can be interpolated into SQL-backed data sets.

They allow you to add in more complicated multi-tenancy rules than what can be provided in the secureFilters object.

For example, you might set the parameters to be;

{
  "user_id": "user one"
}

and then in your SQL-backed data set, you could use this value by doing;

SELECT
  user_name,
  payment_amount,
  payment_date
FROM payments
WHERE user_id = {{trusted.user_id}};

Test parameters

When building SQL backed data sets, you will test out the parameters object by entering a valid JSON object into the "Edit test parameters" section of the "New data set" modal setup wizard.


Parameters for per-schema tenancy

Separating customer data by schema is a typical multi-tenancy approach adopted by many. Vizzly enables support for this through the use of parameters in the data access token and SQL backed data sets.

For example, you might add the name of the schema to use into the parameters section of the data access token like this;

{
  "customer_schema": "customer_12345"
}

Which is made available under the trusted key in your SQL backed data set, allowing you to write a SQL backed data set such as;

SELECT name, salary, born_on from {{ trusted.customer_schema }}.hr_payroll 

This will then securely interpolate the customer_schema value into the SQL before it is executed, and create the following SQL to run against your DB;

SELECT name, salary, born_on from customer_12345.hr_payroll