HOW TO
- Access Custom Metrics and Metric Builder for Amazon Redshift
- Use the Metric Builder for Amazon Redshift
- Create a Custom Amazon Redshift Metric [Example]
- Add a Custom Amazon Redshift Metric to a Databoard
- Additional Information
How to access Custom Metrics and Metric Builder for Amazon Redshift
Navigate to Metrics > Custom Metrics to access the Metric Builder for Amazon Redshift. Click the green + New Custom Metric button and select your connected Amazon Redshift Data Source from the Data Source drop-down list.
Metric Builder is available on the Professional and higher plans. Request a trial of Metric Builder by following these steps.
How to use the Metric Builder for Amazon Redshift
- Daily Values: This Data Type should be selected when your Metric reflects the most up-to-date Daily Value for the Metric. In Databox, the latest daily entry will be displayed for the Custom Metric.
- Total Values: This Data Type should be selected when your Metric reflects the current total Value for the Metric. In Databox, the latest entry will be displayed for the Custom Metric.
For longer Date Ranges, data will be not aggregated and the most recent Value will be displayed for the selected Date Range. This is the main difference between "Total Values" and "Daily Values." - Event Values: This Data Type should be selected when your Metric Value selection reflects individual Value(s) for the Metric at the specified Date/ Timestamp. This Data Type is the default selection because it is appropriate for the majority of use cases.
For longer Date Ranges, individual Metric Values will be aggregated for the entire Date Range and the aggregated Value will be displayed for the Custom Metric.
How to create a Custom Amazon Redshift Metric [Example]
The Metric Builder for Amazon Redshift is designed so you can directly enter SQL queries. For our example, we will use an Amazon Redshift Data Source and create a Custom Metric that returns a list of authors and their current post count.
- Navigate to Metrics > Custom Metrics
- Click the green + New Custom Metric button
- Select the appropriate Amazon Redshift Data Source
- In the SQL field, we will enter the query below. A semicolon at the end of the query is not necessary
SELECT COUNT(p.ID) AS posts, u.display_name FROM users u, posts p WHERE p.post_author=u.ID AND p.post_type='post' GROUP BY u.ID
If you don’t see any data, double check your SQL query and try it directly in your Database. If no results are displayed there, an error exists in your query. You should also check to confirm that the Amazon Redshift user has the necessary permissions to access the Database from Databox's public IP.
How to add a Custom Amazon Redshift Metric to a Databoard
Learn how to add a Custom Metric to a Databoard here.
Additional Information
- Query results are limited to 10 MB. If more than 10 MB of data is returned in a response to a query, an error message will be displayed in Databox. Please edit your query to successfully sync the data.
- The query must contain a column named "Date." If you need to, use AS in your SELECT statement to satisfy this requirement
- One column should always contain the Metric Value
- "Null" values will not be recognized. Use a COALESCE function when needed. Learn more here.