Creates a new Snowflake notebook or replaces an existing notebook.
Syntax¶CREATE [ OR REPLACE ] NOTEBOOK [ IF NOT EXISTS ] <name> [ FROM '<source_location>' ] [ MAIN_FILE = '<main_file_name>' ] [ COMMENT = '<string_literal>' ] [ QUERY_WAREHOUSE = <warehouse_to_run_nb_and_sql_queries_in> ] [ IDLE_AUTO_SHUTDOWN_TIME_SECONDS = <number_of_seconds> ] [ WAREHOUSE = <warehouse_to_run_notebook_python_runtime> ]
Copy
Required parameters¶name
String that specifies the identifier (i.e. name) for the notebook; must be unique for the schema in which the notebook is created.
In addition, the identifier must start with an alphabetic character and cannot contain spaces or special characters unless the entire identifier string is enclosed in double quotes (for example, "My object"
). Identifiers enclosed in double quotes are also case-sensitive.
For more information, see Identifier requirements.
FROM 'source_location'
Specifies that the notebook should be created from an .ipynb
file in the specified stage location. To create the notebook from a file on a stage, set source_location
to the stage location of the file, and set the MAIN_FILE parameter to the name of the file.
If this parameter is not specified, the notebook object is created from a template notebook.
MAIN_FILE = 'main_file_name'
User-specified identifier for the notebook file name. This is separate from the notebook object name, which is specified in the name
parameter. This file must be an ipynb
file.
QUERY_WAREHOUSE = warehouse_name
Specifies the warehouse where SQL queries in the notebook are run. This parameter is optional. However, it is required to run the EXECUTE NOTEBOOK command.
IDLE_AUTO_SHUTDOWN_TIME_SECONDS = number_of_seconds
Number of seconds of idle time before the notebook is shut down automatically. This parameter is only available for notebooks running on the Container Runtime. The value must be an integer between 60 and 259200 (72 hours).
Default: 3600 seconds
WAREHOUSE = warehouse_name
Warehouse that runs the notebook kernel and python code.
If no warehouse is specified when you create a notebook, Snowflake uses the default warehouse defined by the schema lineage parameter DEFAULT_STREAMLIT_NOTEBOOK_WAREHOUSE. You can set this parameter at the schema, database, or account lineage level to define a preferred warehouse.
A role used to execute this operation must have the following privileges at a minimum:
Privilege
Object
USAGE
Database
USAGE or OWNERSHIP
Schema
CREATE NOTEBOOK
Schema
The USAGE privilege on the parent database and schema are required to perform operations on any object in a schema.
For instructions on creating a custom role with a specified set of privileges, see Creating custom roles.
For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.
Usage notes¶Regarding metadata:
Attention
Customers should ensure that no personal data (other than for a User object), sensitive data, export-controlled data, or other regulated data is entered as metadata when using the Snowflake service. For more information, see Metadata fields in Snowflake.
The OR REPLACE
and IF NOT EXISTS
clauses are mutually exclusive. They can’t both be used in the same statement.
CREATE OR REPLACE <object> statements are atomic. That is, when an object is replaced, the old object is deleted and the new object is created in a single transaction.
The following creates a notebook named mynotebook
:
CREATE NOTEBOOK mynotebook;
Copy
Although the QUERY_WAREHOUSE parameter is optional, specifying it is recommended when creating a new notebook so that EXECUTE NOTEBOOK can be run on the warehouse.
CREATE NOTEBOOK mynotebook QUERY_WAREHOUSE = my_warehouse;
Copy
The following example creates a notebook from an ipynb
file on a stage:
CREATE NOTEBOOK mynotebook FROM '@my_db.my_schema.my_stage' MAIN_FILE = 'my_notebook_file.ipynb' QUERY_WAREHOUSE = my_warehouse;
Copy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4