streamlits
Creates, updates, deletes, gets or lists a streamlits resource.
Overview
| Name | streamlits |
| Type | Resource |
| Id | snowflake.apps.streamlits |
Fields
The following fields are returned by SELECT queries:
- get
- list
Successful
| Name | Datatype | Description |
|---|---|---|
name | string | Name of the Streamlit (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$) |
url_id | string | A unique ID associated with the Streamlit object's URL. |
database_name | string | Database in which the Streamlit is stored (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$) |
schema_name | string | Schema in which the Streamlit is stored (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$) |
comment | string | Optional description of the Streamlit app, used for documentation or metadata purposes |
created_on | string (date-time) | Date and time when the Streamlit was created. |
default_packages | array | Default Python packages for Streamlit apps. |
default_version | string | The default version name of Streamlit. Valid values are "first" (first version), "last" (latest version), or "version$N" (specific version, e.g., "version$1"). Custom names are not supported. |
default_version_details | object | The version details of a file-based entity |
external_access_integrations | array | List of external access integrations needed in order for the Streamlit app code to access external networks. |
external_access_secrets | string | Secrets needed for the Streamlit app code to access external networks. |
imports | array | List of files to be imported from a stage. |
last_version_details | object | The version details of a file-based entity |
live_version_location_uri | string | The location of the Streamlit object's live version files. |
main_file | string | Name and path of the entry file for the Streamlit app |
owner | string | Role that owns the Streamlit (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$) |
owner_role_type | string | The type of role that owns the Streamlit (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$) |
query_warehouse | string | Warehouse used to run queries issued by the Streamlit app |
source_location | string | The stage from which the source files are copied to initialize the Streamlit app. |
title | string | User-facing title of the Streamlit app. |
user_packages | array | Python packages specified in the environment.yml file. |
A Snowflake Streamlit object
| Name | Datatype | Description |
|---|---|---|
name | string | Name of the Streamlit (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$) |
url_id | string | A unique ID associated with the Streamlit object's URL. |
database_name | string | Database in which the Streamlit is stored (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$) |
schema_name | string | Schema in which the Streamlit is stored (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$) |
comment | string | Optional description of the Streamlit app, used for documentation or metadata purposes |
created_on | string (date-time) | Date and time when the Streamlit was created. |
default_packages | array | Default Python packages for Streamlit apps. |
default_version | string | The default version name of Streamlit. Valid values are "first" (first version), "last" (latest version), or "version$N" (specific version, e.g., "version$1"). Custom names are not supported. |
default_version_details | object | The version details of a file-based entity |
external_access_integrations | array | List of external access integrations needed in order for the Streamlit app code to access external networks. |
external_access_secrets | string | Secrets needed for the Streamlit app code to access external networks. |
imports | array | List of files to be imported from a stage. |
last_version_details | object | The version details of a file-based entity |
live_version_location_uri | string | The location of the Streamlit object's live version files. |
main_file | string | Name and path of the entry file for the Streamlit app |
owner | string | Role that owns the Streamlit (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$) |
owner_role_type | string | The type of role that owns the Streamlit (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$) |
query_warehouse | string | Warehouse used to run queries issued by the Streamlit app |
source_location | string | The stage from which the source files are copied to initialize the Streamlit app. |
title | string | User-facing title of the Streamlit app. |
user_packages | array | Python packages specified in the environment.yml file. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | database_name, schema_name, name, endpoint | Fetch detailed information about a specific Streamlit by name, including metadata, configuration, and version details. | |
list | select | database_name, schema_name, endpoint | like, startsWith, showLimit, fromName | List Streamlits in a schema. Supports filtering with pattern matching. |
create | insert | database_name, schema_name, endpoint, name | createMode | Create a new Streamlit application, or replace an existing one. Supports CREATE, CREATE OR REPLACE, and CREATE IF NOT EXISTS modes. |
delete | delete | database_name, schema_name, name, endpoint | ifExists | Delete a Streamlit. The Streamlit can be restored using undrop within the retention period. |
undrop | exec | database_name, schema_name, name, endpoint | Restore a previously deleted Streamlit within the retention period. | |
rename | exec | database_name, schema_name, name, targetName, endpoint | ifExists, targetDatabase, targetSchema | Rename a Streamlit to a new name, optionally in a different database or schema. |
add_live_version | exec | database_name, schema_name, name, endpoint | fromLast | Add a live version to the Streamlit, making a specific version active for users. |
commit | exec | database_name, schema_name, name, endpoint | If a Git connection is set up, commit the LIVE version of the Streamlit to the Git repository. | |
add_version | exec | database_name, schema_name, name, endpoint, source_location | Add a new version to the Streamlit by copying files from a specified stage location. | |
add_version_from_git | exec | database_name, schema_name, name, endpoint, version, git_ref | Add a new version to the Streamlit using a Git reference URI. The URI can point to either a tag or a commit. | |
abort | exec | database_name, schema_name, name, endpoint | Abort the live version of the Streamlit, discarding uncommitted changes if a Git connection is configured. | |
pull | exec | database_name, schema_name, name, endpoint | Pull the latest changes from the Git repository for a Streamlit with Git integration. | |
push | exec | database_name, schema_name, name, endpoint | Push committed changes from the Streamlit back to its connected Git repository. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
database_name | string | Identifier (i.e. name) for the database to which the resource belongs. You can use the /api/v2/databases GET request to get a list of available databases. |
endpoint | string | Organization and account identifier (orgname-accountname) (default: orgname-accountname) |
name | string | Identifier (i.e. name) for the resource. |
schema_name | string | Identifier (i.e. name) for the schema to which the resource belongs. You can use the /api/v2/databases/{database}/schemas GET request to get a list of available schemas for the specified database. |
targetName | string | Name of the target resource. |
createMode | string | 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. |
fromLast | boolean | Set the LIVE version to the LAST version of the Streamlit. |
fromName | string | 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. |
ifExists | boolean | 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. |
like | string | Parameter to filter the command output by resource name. Uses case-insensitive pattern matching, with support for SQL wildcard characters. |
showLimit | integer | Parameter to limit the maximum number of rows returned by a command. |
startsWith | string | 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. |
targetDatabase | string | Database of the target resource. Defaults to the source's database |
targetSchema | string | Schema of the target resource. Defaults to the source's schema |
SELECT examples
- get
- list
Fetch detailed information about a specific Streamlit by name, including metadata, configuration, and version details.
SELECT
name,
url_id,
database_name,
schema_name,
comment,
created_on,
default_packages,
default_version,
default_version_details,
external_access_integrations,
external_access_secrets,
imports,
last_version_details,
live_version_location_uri,
main_file,
owner,
owner_role_type,
query_warehouse,
source_location,
title,
user_packages
FROM snowflake.apps.streamlits
WHERE database_name = '{{ database_name }}' -- required
AND schema_name = '{{ schema_name }}' -- required
AND name = '{{ name }}' -- required
AND endpoint = '{{ endpoint }}' -- required
;
List Streamlits in a schema. Supports filtering with pattern matching.
SELECT
name,
url_id,
database_name,
schema_name,
comment,
created_on,
default_packages,
default_version,
default_version_details,
external_access_integrations,
external_access_secrets,
imports,
last_version_details,
live_version_location_uri,
main_file,
owner,
owner_role_type,
query_warehouse,
source_location,
title,
user_packages
FROM snowflake.apps.streamlits
WHERE database_name = '{{ database_name }}' -- required
AND schema_name = '{{ schema_name }}' -- required
AND endpoint = '{{ endpoint }}' -- required
AND "like" = '{{ like }}'
AND startsWith = '{{ startsWith }}'
AND showLimit = '{{ showLimit }}'
AND fromName = '{{ fromName }}'
;
INSERT examples
- create
- Manifest
Create a new Streamlit application, or replace an existing one. Supports CREATE, CREATE OR REPLACE, and CREATE IF NOT EXISTS modes.
INSERT INTO snowflake.apps.streamlits (
name,
comment,
imports,
external_access_integrations,
title,
main_file,
query_warehouse,
default_version,
source_location,
database_name,
schema_name,
endpoint,
createMode
)
SELECT
'{{ name }}' /* required */,
'{{ comment }}',
'{{ imports }}',
'{{ external_access_integrations }}',
'{{ title }}',
'{{ main_file }}',
'{{ query_warehouse }}',
'{{ default_version }}',
'{{ source_location }}',
'{{ database_name }}',
'{{ schema_name }}',
'{{ endpoint }}',
'{{ createMode }}'
RETURNING
status
;
# Description fields are for documentation purposes
- name: streamlits
props:
- name: database_name
value: "{{ database_name }}"
description: Required parameter for the streamlits resource.
- name: schema_name
value: "{{ schema_name }}"
description: Required parameter for the streamlits resource.
- name: endpoint
value: "{{ endpoint }}"
description: Required parameter for the streamlits resource.
- name: name
value: "{{ name }}"
description: |
Name of the Streamlit
- name: comment
value: "{{ comment }}"
description: |
Optional description of the Streamlit app, used for documentation or metadata purposes
- name: imports
value:
- "{{ imports }}"
description: |
List of files to be imported from a stage.
- name: external_access_integrations
value:
- "{{ external_access_integrations }}"
description: |
List of external access integrations needed in order for the Streamlit app code to access external networks.
- name: title
value: "{{ title }}"
description: |
User-facing title of the Streamlit app.
- name: main_file
value: "{{ main_file }}"
description: |
Name and path of the entry file for the Streamlit app
- name: query_warehouse
value: "{{ query_warehouse }}"
description: |
Warehouse used to run queries issued by the Streamlit app
- name: default_version
value: "{{ default_version }}"
description: |
The default version name of Streamlit. Valid values are "first" (first version), "last" (latest version), or "version$N" (specific version, e.g., "version$1"). Custom names are not supported.
- name: source_location
value: "{{ source_location }}"
description: |
The stage from which the source files are copied to initialize the Streamlit app.
- name: createMode
value: "{{ createMode }}"
description: 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.
description: 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.
DELETE examples
- delete
Delete a Streamlit. The Streamlit can be restored using undrop within the retention period.
DELETE FROM snowflake.apps.streamlits
WHERE database_name = '{{ database_name }}' --required
AND schema_name = '{{ schema_name }}' --required
AND name = '{{ name }}' --required
AND endpoint = '{{ endpoint }}' --required
AND ifExists = '{{ ifExists }}'
;
Lifecycle Methods
- undrop
- rename
- add_live_version
- commit
- add_version
- add_version_from_git
- abort
- pull
- push
Restore a previously deleted Streamlit within the retention period.
EXEC snowflake.apps.streamlits.undrop
@database_name='{{ database_name }}' --required,
@schema_name='{{ schema_name }}' --required,
@name='{{ name }}' --required,
@endpoint='{{ endpoint }}' --required
;
Rename a Streamlit to a new name, optionally in a different database or schema.
EXEC snowflake.apps.streamlits.rename
@database_name='{{ database_name }}' --required,
@schema_name='{{ schema_name }}' --required,
@name='{{ name }}' --required,
@targetName='{{ targetName }}' --required,
@endpoint='{{ endpoint }}' --required,
@ifExists={{ ifExists }},
@targetDatabase='{{ targetDatabase }}',
@targetSchema='{{ targetSchema }}'
;
Add a live version to the Streamlit, making a specific version active for users.
EXEC snowflake.apps.streamlits.add_live_version
@database_name='{{ database_name }}' --required,
@schema_name='{{ schema_name }}' --required,
@name='{{ name }}' --required,
@endpoint='{{ endpoint }}' --required,
@fromLast={{ fromLast }}
@@json=
'{
"version": "{{ version }}"
}'
;
If a Git connection is set up, commit the LIVE version of the Streamlit to the Git repository.
EXEC snowflake.apps.streamlits.commit
@database_name='{{ database_name }}' --required,
@schema_name='{{ schema_name }}' --required,
@name='{{ name }}' --required,
@endpoint='{{ endpoint }}' --required
@@json=
'{
"version": "{{ version }}"
}'
;
Add a new version to the Streamlit by copying files from a specified stage location.
EXEC snowflake.apps.streamlits.add_version
@database_name='{{ database_name }}' --required,
@schema_name='{{ schema_name }}' --required,
@name='{{ name }}' --required,
@endpoint='{{ endpoint }}' --required
@@json=
'{
"source_location": "{{ source_location }}",
"version": "{{ version }}"
}'
;
Add a new version to the Streamlit using a Git reference URI. The URI can point to either a tag or a commit.
EXEC snowflake.apps.streamlits.add_version_from_git
@database_name='{{ database_name }}' --required,
@schema_name='{{ schema_name }}' --required,
@name='{{ name }}' --required,
@endpoint='{{ endpoint }}' --required
@@json=
'{
"version": "{{ version }}",
"git_ref": "{{ git_ref }}"
}'
;
Abort the live version of the Streamlit, discarding uncommitted changes if a Git connection is configured.
EXEC snowflake.apps.streamlits.abort
@database_name='{{ database_name }}' --required,
@schema_name='{{ schema_name }}' --required,
@name='{{ name }}' --required,
@endpoint='{{ endpoint }}' --required
;
Pull the latest changes from the Git repository for a Streamlit with Git integration.
EXEC snowflake.apps.streamlits.pull
@database_name='{{ database_name }}' --required,
@schema_name='{{ schema_name }}' --required,
@name='{{ name }}' --required,
@endpoint='{{ endpoint }}' --required
;
Push committed changes from the Streamlit back to its connected Git repository.
EXEC snowflake.apps.streamlits.push
@database_name='{{ database_name }}' --required,
@schema_name='{{ schema_name }}' --required,
@name='{{ name }}' --required,
@endpoint='{{ endpoint }}' --required
@@json=
'{
"auth_type": "{{ auth_type }}"
}'
;