Queries

In Redash to create charts and display them on the dashboard the charts need queries.

When users are first presented with the dashboard there is a welcome box on the left side fo the screen. Welcome Box Welcome Box This Text Box appears by default for any Blank Report created, with instructions for users how to create their first query.

As the text box says the first thing that users will need to do is go to the create button at the top of the screen in the navigation bar and select Query from the list. Create List Create List

By selecting Query you will be taken to the queries page.

Query Screen Query Screen

The query page has two main parts to it. The right side of the page is where the pulled data and visuals are displayed, and the left side where the Schema Browser is. The schema browser is where all the currently executed model output views are available for every model in that particular client.

The first thing to do with this screen is to copy and paste the line of code in the text box into the code window at the top right of the screen.

select concat(StudyName, '.', ScenarioName) AS "Study/Scenario::multi-filter", * from "client_name"."model_name_table_name_vw" Code Window Code Window

The client_name will already be preset in your line of code to the client you are currently in. You will want to replace the model_name and table_name_vw with the appropriate model name and table that you want to draw data from. For example:

If you had a model called Python Application and you wanted to see what the output results from that were you would type this as the following python_application_appoutput_vw. where the model_name has become python_application_, and the table name is appoutput_vw

You can also enter the code in the following format:

SELECT concat(StudyName, '.', ScenarioName) AS "Study/Scenario::multi-filter",
       *
FROM "client_name"."model_name"\_"table_name_vw"

Once you have enetered your code click Save and then Execute, both at the bottom of the code window. Once the code has executed redash will pull the data from the model and populate its result table so that users can create visualizations.

Warning

A query can only pull data into redash if there is data to pull, meanign that if scenarios have not been run within the model, and they have not returned complete then there will be no data to pull into redash.

For more information on redash queries please click here.