Introducing the Snowflake Enterprise plugin for Grafana

Published: 23 Oct 2020

It’s always an exciting feeling releasing a new feature or enhancement. As it gets colder here in the northeast of the U.S. and I dream of traveling somewhere warm, why not talk about SNOWflake?

Snowflake offers a cloud-based data storage and analytics service, generally termed “data warehouse-as-a-service.” The main benefit of Snowflake is that you pay for compute and storage that you “actually use,” so it’s not “just another database.” Snowflake has become very popular over the last few years, culminating in a huge IPO just a couple of weeks ago, by allowing enterprise users to affordably store and analyze data using cloud-based hardware and software. Lots of companies use Snowflake to store application and business data like transaction counts, active user sessions, and even time series or metric data. It makes sense that you’d want to visualize your Snowflake data alongside your other data sources in Grafana, in order to put log and metric information in context… and now you can!

The Snowflake Enterprise plugin for Grafana sports a Monaco-powered, type-ahead query editor and supports annotations and alerts, so you can overlay events from Snowflake on top of other charts or get alerted when Snowflake data falls outside a certain threshold. As with the SQL Server plugin, you can format your query results as a table or as time series data. Here’s a quick look at some of the plugin’s functionality.

Getting started

Once you’ve installed the Snowflake plugin, configure Snowflake as a data source by going to Configuration > Data Sources > Add data source. Select Snowflake.

Add your authentication details, and the data source is ready to query!

Quick tip: Click on the Permissions tab to enable data source permissions, an Enterprise feature that allows you to control who can query the data source.

Let’s get to querying!

The query editor is a Smart SQL auto-completion editor, allowing you to format as time series or table.

Neat!

Variables are my favorite, and easy to do by simply adding it in the query:

select
  <column>
from 
  <table>
WHERE <column> = '$variable'

Multi-value variables can be used in the query like so:

WHERE $__timeFilter(start_time) AND query_type regexp '${queryType:regex}'

And here’s how the variable looks in Grafana:

Alerting and annotations

Now that you’ve got some queries, how about we add some alerts?

Lastly, I want to talk about annotations. Annotations provide a way to mark points on the graph with rich events.

In this example I’m using this annotation query to show me successful logins and IP as an annotation:

SELECT
   EVENT_TIMESTAMP as time,
   EVENT_TYPE,
   CLIENT_IP
FROM ACCOUNT_USAGE.LOGIN_HISTORY
WHERE $__timeFilter(time) AND IS_SUCCESS='YES'
ORDER BY time ASC;

Last tip: Within the data source, you can import the dashboard we have used in the examples to help get you started with querying, variables, and annotations.

This dashboard shows you useful billing and usage information. It uses the ACCOUNT_USAGE database, and requires the querier to have the ACCOUNTADMIN role.

To do this securely, you can create a new Grafana data source that has a user with the ACCOUNTADMIN role, and select that data source in the variables above.

Read more about the plugin details here, and find out more about Grafana Enterprise here. Let us know what you think!

Related Posts

The new Grafana data source enables a flexible view of your systems and applications to quickly correlate and debug.
Here's what you need to know about the updated ServiceNow data source for Grafana.
By integrating Dynatrace with Grafana, you can easily create user-friendly, exec-ready dashboards from your Metrics API v2 data and custom metrics.