Snowflake data source for Grafana

The Snowflake data source plugin allows you to query and visualize Snowflake data metrics from within Grafana.


The Snowflake data source has the following requirements:

  • Grafana Enterprise with a valid license
  • Grafana user with a server admin or org admin role
  • A Snowflake user with the appropriate role granted
    • This data source does not require any specific role.
    • The Snowflake user’s role is what allows that user to access tables. In order to query your data, ensure your user has the appropriate roles.

Known limitations

  • Only Username / Password authentication is supported

Install the Snowflake data source plugin

To install the data source, refer to Installation

Configure Snowflake

Configuring the Snowflake data source requires a Snowflake user with a username and a password.

Grafana recommends creating a new user with limited permissions for this data source.

Create a user

In order to connect to Snowflake, you must create a user or authenticate using an existing one. This user will run all queries sent from Grafana.

If you would like to have separate users run different queries / workloads, then you should create multiple Snowflake data sources with different settings.

To create a user in Snowflake, you will have to log in to your Snowflake instance and run the CREATE USER command.

Grant a role

Now that the Snowflake user is created, the user must be granted a role using the GRANT ROLE command. Granting a role to a user allows the user to perform operations allowed by that role.

This role is what defines what warehouses and tables the user has access to.

Configure the data source in Grafana

These connection settings are the same that are used in connecting via SnowSQL

Add a data source by filling in the following fields:

A name for this particular Snowflake data source
Account is the name of the Snowflake account assigned by Snowflake. In the URL received from Snowflake after the account was provisioned, the account name is the entire string to the left of If the Snowflake instance is not on us-west-2, then the region must be included in the account name. Example: If the Snowflake instance is not on Amazon Web Services, then the platform must also be included in the account name. Example:
The username of the account that will query Snowflake
The password of the account that will query Snowflake
Deprecated in favor of Account. Region specifies the region where the Snowflake instance lives
This option allows users to connect to the Snowflake instance using a role that is not the default for the user. The role must still be granted to the user using the GRANT ROLE command in order for it to be assumed.
The warehouse to use by default for queries
The database to use by default for queries
The schema to use by default for queries

Configure the data source with provisioning

It is possible to configure data sources using config files with Grafana’s provisioning system. You can read more about how it works and all the settings you can set for data sources on the provisioning docs page


  - name: Snowflake
    type: grafana-snowflake-datasource
    access: proxy
    basicAuth: false
    editable: true
    enabled: true
      username: grafana-user
      password: grafana-password
  - name: Snowflake Billing Data
    type: grafana-snowflake-datasource
    access: proxy
    basicAuth: false
    editable: true
    enabled: true
      username: grafana-admin-user
      database: snowflake
      role: ACCOUNTADMIN
      password: grafana-admin-password

Query the data source

The provided query editor is a standard SQL query editor. Grafana includes some macros to help with writing more complex timeseries queries.


Macro Description Output example
$__timeFilter(column) $__timeFilter creates a conditional that filters the data (using column) based on the time range of the panel CONVERT_TIMEZONE('UTC', time) < '2017-07-18T11:15:52Z' AND CONVERT_TIMEZONE('UTC', time) > '2017-07-18T11:15:52Z
$__timeGroup(column, $__interval) $__timeGroup groups timestamps by the interval so that there is only 1 point for every $__interval on the graph TIME_SLICE(TO_TIMESTAMP(created_ts), 1, 'HOUR', 'START')


Table Visualization

Most queries in Snowflake will be best represented by a table visualization. Any query will display data in a table. If it can be queried, then it can be put in a table.

This example returns results for a table visualization:

SELECT {column_1}, {column_2} FROM {table};

Timeseries / Graph visualizations

For timeseries / graph visualizations, there are a few requirements:

  • A column with a date or datetime type must be selected
  • The date column must be in ascending order (using ORDER BY column ASC)
  • A numberic column must also be selected

To make a more reasonable graph, be sure to use the $__timeFilter and $__timeGroup macros.

Example timeseries query:

  avg(execution_time) AS average_execution_time,
  $__timeGroup(start_time, $__interval),
group by 
order by 
  start_time,query_type ASC;

Inspecting the query

Because Grafana supports macros that Snowflake does not, the fully rendered query, which can be copy/pasted directly into Snowflake, is visible in the Query Inspector. To view the full interpolated query, click the Query Inspector button, and the full query will be visible under the “Query” tab.

Templates and variables

To add a new Snowflake query variable, refer to Add a query variable. Use your Snowflake data source as your data source for the following available queries:

Any value queried from a Snowflake table can be used as a variable. Be sure to avoid selecting too many values, as this can cause performance issues.

After creating a variable, you can use it in your Snowflake queries by using Variable syntax. For more information about variables, refer to Templates and variables.

Multi-value variables

To use a variable that has multiple values, you can use the regex modifer option and the regexp Snowflake function. E.g. ${variable:regex}

For example, this query will filter using only the Query Types selected in the queryType variable:

  AND query_type regexp '${queryType:regex}'

This query translates to:


Import a dashboard for Snowflake

The bundled Snowflake dashboard requires a data source with an ACCOUNTADMIN role for viewing billing data. There is an example of this in the provisioning section.

Follow these instructions for importing a dashboard.

Imported dashboards can be found in Configuration > Data Sources > select your Snowflake data source > select the Dashboards tab to see available pre-made dashboards.

Get the most out of the plugin