notebooks
Creates, updates, deletes, gets or lists a notebooks
resource.
Overview
Name | notebooks |
Type | Resource |
Id | snowflake.notebook.notebooks |
Fields
Name | Datatype | Description |
---|---|---|
name | string | Name of the notebook |
budget | string | Name of the budget if the notebook is monitored by a budget |
comment | string | user comment associated to an object in the dictionary |
compute_pool | string | Compute pool name where the snowservice runs |
created_on | string | Date and time when the notebook was created. |
database_name | string | Database in which the notebook is stored |
default_packages | string | Default packages of the notebook |
default_version | string | The default version name of a file based entity. |
default_version_details | object | The version details of a file based entity |
external_access_integrations | array | List of external access integrations attached to this function |
external_access_secrets | string | Secrets to be used with this function for external access |
fromLocation | string | Location to copy the file from. This must be a Snowflake stage location. |
idle_auto_shutdown_time_seconds | integer | Sets the time in seconds for when to shutdown an idle Notebook. |
import_urls | array | List of urls |
last_version_details | object | The version details of a file based entity |
live_version_location_uri | string | The current version location |
main_file | string | Name + path of the file for the Notebook |
owner | string | Role that owns the notebook |
owner_role_type | string | The type of role that owns the notebook |
query_warehouse | string | Warehouse against which the queries issued by the Streamlit app are run against |
runtime_name | string | The runtime to run the Streamlit or Notebook on. If this is not set, the warehouse is assumed |
schema_name | string | Schema in which the notebook is stored |
title | string | User facing title of the Streamlit app or an Organization Profile |
url_id | string | Unique ID associated with the notebook object. |
user_packages | string | User packages of the notebook |
version | string | User specified version alias |
Methods
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
fetch_notebook | SELECT | database_name, name, schema_name, endpoint | - | Fetch a notebook |
list_notebooks | SELECT | database_name, schema_name, endpoint | like , startsWith , showLimit , fromName | List notebooks |
create_notebook | INSERT | database_name, schema_name, data__name, endpoint | createMode | Create a notebook |
delete_notebook | DELETE | database_name, name, schema_name, endpoint | ifExists | Delete a notebook |
add_live_version_notebook | EXEC | database_name, name, schema_name, endpoint | fromLast , comment | Adds a LIVE version to the notebook |
commit_notebook | EXEC | database_name, name, schema_name, endpoint | version , comment | If a Git connection is set up for the notebook, commits the LIVE version of the notebook to the Git repository |
execute_notebook | EXEC | database_name, name, schema_name, endpoint | asyncExec | Execute a Notebook |
rename_notebook | EXEC | database_name, name, schema_name, targetName, endpoint | ifExists , targetDatabase , targetSchema | Changes the name of the notebook to new name. The new identifier must be unique for the schema. |
Optional Parameter Details
Name | Description | Type | Default |
---|---|---|---|
asyncExec | Asynchronous execution enable/disable. Default is disable. | boolean | false |
comment | Sets a comment for the notebook or version of the notebook | string | - |
createMode | Query parameter allowing support for different modes of resource creation. Possible values include: - errorIfExists : Throws an error if you try to create a resource that already exists. - orReplace : Automatically replaces the existing resource with the current one. - ifNotExists : Creates a new resource when an alter is requested for a non-existent resource. | string | errorIfExists |
fromLast | Sets the LIVE version to the LAST version of the notebook | boolean | - |
fromName | Query parameter to enable fetching rows only following the first row whose object name matches the specified string. Case-sensitive and does not have to be the full name. | string | - |
ifExists | Query parameter that specifies how to handle the request for a resource that does not exist: - true : The endpoint does not throw an error if the resource does not exist. It returns a 200 success response, but does not take any action on the resource. - false : The endpoint throws an error if the resource doesn't exist. | boolean | false |
like | Query parameter to filter the command output by resource name. Uses case-insensitive pattern matching, with support for SQL wildcard characters. | string | - |
showLimit | Query parameter to limit the maximum number of rows returned by a command. | integer | - |
startsWith | Query parameter to filter the command output based on the string of characters that appear at the beginning of the object name. Uses case-sensitive pattern matching. | string | - |
targetDatabase | Database of the target resource. Defaults to the source's database | string | - |
targetSchema | Schema of the target resource. Defaults to the source's schema | string | - |
version | live version of the alias | string | - |
SELECT
examples
List notebooks
SELECT
name,
budget,
comment,
compute_pool,
created_on,
database_name,
default_packages,
default_version,
default_version_details,
external_access_integrations,
external_access_secrets,
fromLocation,
idle_auto_shutdown_time_seconds,
import_urls,
last_version_details,
live_version_location_uri,
main_file,
owner,
owner_role_type,
query_warehouse,
runtime_name,
schema_name,
title,
url_id,
user_packages,
version
FROM snowflake.notebook.notebooks
WHERE database_name = '{{ database_name }}'
AND schema_name = '{{ schema_name }}'
AND endpoint = '{{ endpoint }}';
INSERT
example
Use the following StackQL query and manifest file to create a new notebooks
resource.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO snowflake.notebook.notebooks (
data__name,
data__version,
data__fromLocation,
data__main_file,
data__comment,
data__default_version,
data__query_warehouse,
data__default_version_details,
data__last_version_details,
database_name,
schema_name,
endpoint
)
SELECT
'{{ name }}',
'{{ version }}',
'{{ fromLocation }}',
'{{ main_file }}',
'{{ comment }}',
'{{ default_version }}',
'{{ query_warehouse }}',
'{{ default_version_details }}',
'{{ last_version_details }}',
'{{ database_name }}',
'{{ schema_name }}',
'{{ endpoint }}'
;
/*+ create */
INSERT INTO snowflake.notebook.notebooks (
data__name,
database_name,
schema_name,
endpoint
)
SELECT
'{{ name }}',
'{{ database_name }}',
'{{ schema_name }}',
'{{ endpoint }}'
;
- name: notebooks
props:
- name: database_name
value: string
- name: schema_name
value: string
- name: data__name
value: string
- name: endpoint
value: string
- name: name
value: string
- name: version
value: string
- name: fromLocation
value: string
- name: main_file
value: string
- name: comment
value: string
- name: default_version
value: string
- name: query_warehouse
value: string
- name: default_version_details
props: []
- name: last_version_details
props: []
DELETE
example
Deletes the specified notebooks
resource.
/*+ delete */
DELETE FROM snowflake.notebook.notebooks
WHERE database_name = '{{ database_name }}'
AND name = '{{ name }}'
AND schema_name = '{{ schema_name }}'
AND endpoint = '{{ endpoint }}';