Set up Snowflake Notebooks

With Snowflake Notebooks you can write and execute code, visualize results, capture notes, and share insights with other Snowflake users. This page provides steps for setting up your account to use Snowflake Notebooks.

If you are an admin for your account, see the Admin Setup instructions for Snowflake Notebooks.

If Snowflake Notebooks access has already been set up by an admin for your account, see the User Setup instructions for Snowflake Notebooks.

User Setup instructions for Snowflake Notebooks

Before you start using Snowflake Notebooks, perform these setup steps.

Create a dedicated database and schema (optional)

To create a notebook, you need a database and schema to store your notebook. You can use an existing database and schema or create new ones to store and manage Snowflake Notebooks.

To simplify storing and managing Snowflake Notebooks, Snowflake recommends creating a dedicated database and schema.

To create a dedicated churn_analysis database and schema to store your Snowflake Notebooks, run the following SQL commands:

CREATE DATABASE churn_analysis;
USE DATABASE churn_analysis;
CREATE SCHEMA notebooks;
Copy

Note that your notebooks do not have to be stored in the same database and schema as the data you’re working with. As shown in the previous example, you can organize notebooks based on projects.

Having a dedicated location for storing and managing notebooks can also prevent notebooks from being dropped when a database or schema is dropped.

Privileges required to create or modify a notebook

To help you manage who can create notebooks, Snowflake provides a dedicated schema-level privilege. When you create a notebook, the role that owns the notebook is the active role in your session. Any user with the role can open, run, and edit notebooks owned by that role. You cannot share the notebook with other roles.

Because each notebook is owned by a role, you might want to create a dedicated role for creating and running notebooks.

To create a notebook, you must use a role that has the following privileges:

Privilege

Object

USAGE

Database

USAGE or OWNERSHIP

Schema

CREATE NOTEBOOK

Schema

Grant those privileges on the database and schema that you created to contain your notebooks to a custom role. For example, the following SQL commands show how to grant the required privileges on a database named notebooks and a schema named notebooks to a role named create_notebooks:

GRANT USAGE ON DATABASE notebooks TO ROLE create_notebooks;
GRANT USAGE ON SCHEMA notebooks TO ROLE create_notebooks;
GRANT CREATE NOTEBOOK ON SCHEMA notebooks TO ROLE create_notebooks;
Copy

Warehouse recommendations for running Snowflake Notebooks

When you create a notebook, you select a warehouse in which to run the notebook processes and any code. Start by using an X-Small warehouse to minimize credit consumption.

You might want to run large queries using SQL or perform compute-intensive operations using Snowpark Python that require a larger warehouse. In this case, you have two options:

  • Specify a warehouse to use for a specific cell or set of cells.

    This ensures that the queries in those cells use the larger warehouse, but notebook processes continue to run on the smaller notebook warehouse, so you’ll use less compute when you’re not running queries.

    For example, to specify a warehouse called notebooks to use for specific cells, you can add a SQL cell with the USE WAREHOUSE command or add the command to the Python code in a Python cell:

    SQL::
    USE WAREHOUSE notebooks;
    
    Copy
    Python::
    session.sql('USE WAREHOUSE notebooks;')
    
    Copy

    After you run any cell specifying USE WAREHOUSE, all cells that run in the remainder of the notebook session use the specified warehouse. If you no longer need queries to run with a large warehouse, write a new cell to specify a smaller warehouse to use.

  • Choose a larger warehouse for the entire notebook.

    If you choose this option, all queries that run in the notebook have more compute available, but the warehouse runs for the entire notebook session, even if queries do not run.

    Caution

    Choosing this option can dramatically increase credit consumption for the entire notebook, since the larger warehouse is used for the entire notebook session.

    To change the notebook warehouse:

    1. Sign in to Snowsight.

    2. Select Projects » Notebooks.

    3. Select on the vertical ellipsis (more actions for worksheet) on the top right of your notebook.

    4. Select Notebook settings.

    5. Select a new warehouse to use.

Admin Setup instructions for Snowflake Notebooks

To set up your organization using Snowflake Notebooks, perform these setup steps:

Account and deployment considerations for using Snowflake Notebooks

Ensure that *.snowflake.app is on the allowlist in your network and can connect to Snowflake. When this domain is on the allowlist, your apps can communicate with Snowflake servers without any restrictions.

In addition, the following account considerations apply:

  • Your Snowflake account must be located in an Amazon Web Services (AWS) or Microsoft Azure region.

  • Accounts in the following regions are not currently supported:

    • Google Cloud Platform (GCP)

    • Virtual Private Snowflake (VPS)

    • US government regions that support FedRAMP

  • Using AWS PrivateLink or Azure Private Link is not supported.

  • The combined length of your account name and organization name must be less than 41 characters.

  • Your account name must be unique within your organization.

Accept the Anaconda Terms to import libraries

Before you start using the packages provided by Anaconda inside Snowflake, you must acknowledge the External Offerings Terms.

Note

You must be the organization administrator (use the ORGADMIN role) to accept the terms. You only need to accept the terms once for your Snowflake account. See Enabling the ORGADMIN role in an account.

  1. Sign in to Snowsight.

  2. Select Admin » Billing & Terms.

  3. In the Anaconda section, select Enable.

  4. In the Anaconda Packages dialog, click the link to review the External Offerings Terms page.

  5. If you agree to the terms, select Acknowledge & Continue.

If you see an error when attempting to accept the terms of service, your user profile might be missing a first name, last name, or email address. If you have an administrator role, refer to Add user details to your user profile to update your profile using Snowsight. Otherwise, contact an administrator to update your account.

Billing considerations for running Snowflake Notebooks

Running a Snowflake Notebook requires a virtual warehouse.

Similar to billing for a Streamlit app, a Snowflake Notebook uses a websocket connection to run queries. The virtual warehouse remains active while the websocket connection is active. The connection expires when you close your notebook or approximately 60 minutes after it is last used by a notebook, whichever is sooner. Each notebook has its own session.

See Warehouse recommendations for running Snowflake Notebooks.

Get started using notebooks by adding data

Before you get started using Snowflake Notebooks, add data to Snowflake.

You can add data to Snowflake in several ways:

You can also add data in other ways. See Overview of data loading for complete details.

Next step