Skip to main content

streamlits

Creates, updates, deletes, gets or lists a streamlits resource.

Overview

Namestreamlits
TypeResource
Idsnowflake.apps.streamlits

Fields

The following fields are returned by SELECT queries:

Successful

NameDatatypeDescription
namestringName of the Streamlit (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$)
url_idstringA unique ID associated with the Streamlit object's URL.
database_namestringDatabase in which the Streamlit is stored (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$)
schema_namestringSchema in which the Streamlit is stored (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$)
commentstringOptional description of the Streamlit app, used for documentation or metadata purposes
created_onstring (date-time)Date and time when the Streamlit was created.
default_packagesarrayDefault Python packages for Streamlit apps.
default_versionstringThe 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_detailsobjectThe version details of a file-based entity
external_access_integrationsarrayList of external access integrations needed in order for the Streamlit app code to access external networks.
external_access_secretsstringSecrets needed for the Streamlit app code to access external networks.
importsarrayList of files to be imported from a stage.
last_version_detailsobjectThe version details of a file-based entity
live_version_location_uristringThe location of the Streamlit object's live version files.
main_filestringName and path of the entry file for the Streamlit app
ownerstringRole that owns the Streamlit (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$)
owner_role_typestringThe type of role that owns the Streamlit (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$)
query_warehousestringWarehouse used to run queries issued by the Streamlit app
source_locationstringThe stage from which the source files are copied to initialize the Streamlit app.
titlestringUser-facing title of the Streamlit app.
user_packagesarrayPython packages specified in the environment.yml file.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectdatabase_name, schema_name, name, endpointFetch detailed information about a specific Streamlit by name, including metadata, configuration, and version details.
listselectdatabase_name, schema_name, endpointlike, startsWith, showLimit, fromNameList Streamlits in a schema. Supports filtering with pattern matching.
createinsertdatabase_name, schema_name, endpoint, namecreateModeCreate a new Streamlit application, or replace an existing one. Supports CREATE, CREATE OR REPLACE, and CREATE IF NOT EXISTS modes.
deletedeletedatabase_name, schema_name, name, endpointifExistsDelete a Streamlit. The Streamlit can be restored using undrop within the retention period.
undropexecdatabase_name, schema_name, name, endpointRestore a previously deleted Streamlit within the retention period.
renameexecdatabase_name, schema_name, name, targetName, endpointifExists, targetDatabase, targetSchemaRename a Streamlit to a new name, optionally in a different database or schema.
add_live_versionexecdatabase_name, schema_name, name, endpointfromLastAdd a live version to the Streamlit, making a specific version active for users.
commitexecdatabase_name, schema_name, name, endpointIf a Git connection is set up, commit the LIVE version of the Streamlit to the Git repository.
add_versionexecdatabase_name, schema_name, name, endpoint, source_locationAdd a new version to the Streamlit by copying files from a specified stage location.
add_version_from_gitexecdatabase_name, schema_name, name, endpoint, version, git_refAdd a new version to the Streamlit using a Git reference URI. The URI can point to either a tag or a commit.
abortexecdatabase_name, schema_name, name, endpointAbort the live version of the Streamlit, discarding uncommitted changes if a Git connection is configured.
pullexecdatabase_name, schema_name, name, endpointPull the latest changes from the Git repository for a Streamlit with Git integration.
pushexecdatabase_name, schema_name, name, endpointPush 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.

NameDatatypeDescription
database_namestringIdentifier (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.
endpointstringOrganization and account identifier (orgname-accountname) (default: orgname-accountname)
namestringIdentifier (i.e. name) for the resource.
schema_namestringIdentifier (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.
targetNamestringName of the target resource.
createModestringParameter 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.
fromLastbooleanSet the LIVE version to the LAST version of the Streamlit.
fromNamestringParameter 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.
ifExistsbooleanParameter 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.
likestringParameter to filter the command output by resource name. Uses case-insensitive pattern matching, with support for SQL wildcard characters.
showLimitintegerParameter to limit the maximum number of rows returned by a command.
startsWithstringParameter 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.
targetDatabasestringDatabase of the target resource. Defaults to the source's database
targetSchemastringSchema of the target resource. Defaults to the source's schema

SELECT examples

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
;

INSERT examples

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
;

DELETE examples

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

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
;