Notebooks with external access
In this tutorial we will show how to connect a notebook to an external api to get data from it.
Video
Requirement
- Must be on a on-demand (Paying) or contracted account. This is due to external access not being allowed on trial accounts. We also assume not complex security requirement.
Downloads
- Notebook (Link)
Setup
Lets start the network setup prcoess in Snowflake.
If you don't have a database, schema or warehouse yet.
use role sysadmin;
-- Create a database to store our schemas.
create database if not exists raw;
-- Create the schema. The schema stores all our objectss.
create schema if not exists raw.api;
/*
Warehouses are synonymous with the idea of compute
resources in other systems. We will use this
warehouse to call our user defined function.
*/
create warehouse if not exists developer
warehouse_size = xsmall
initially_suspended = true;
use database raw;
use schema api;
use warehouse developer;
External Access
First lets start by setting up the network rules in a worksheet to allow our Snowflake Notebook to talk with our external source.
Notebook
Next lets import the example notebook in our database / schema.
Next lets assign it to our database/schema
To enable our notebook to talk outside of Snowflake we'll have to enable the notebook to use that external access we created before. We can do this by going to Notebooks settings.
Next clicking "external access" and then checking our external access.
Finally we'll click "run all" and see our notebook query an outside source and put the results into a table for us.