ALTER STREAMLIT

statementpartialContainer services & dev tooling

docs.snowflake.com ↗

Object: STREAMLIT

Modifies the properties of an existing Streamlit object.

Syntax

supportedpartialnot supportednot scored

ALTER STREAMLIT [ IF EXISTS ] <name> SET
  [ MAIN_FILE = '<filename>']
  [ QUERY_WAREHOUSE = <warehouse_name> ]
  [ RUNTIME_NAME = '<runtime_name>' ]
  [ COMPUTE_POOL = <compute_pool_name> ]
  [ COMMENT = '<string_literal>']
  [ TITLE = '<app_title>' ]
  [ IMPORTS = ( '<stage_path_and_directory_or_file_name_to_read>' [ , ... ] ) ]
  [ EXTERNAL_ACCESS_INTEGRATIONS = ( <integration_name> [ , ... ] ) ]
  [ SECRETS = ( '<snowflake_secret_name>' = <snowflake_secret> [ , ... ] ) ]

ALTER STREAMLIT [ IF EXISTS ] <name> UNSET { SECRETS                      |
                                             EXTERNAL_ACCESS_INTEGRATIONS |
                                             QUERY_WAREHOUSE              |
                                             TITLE                        |
                                             COMMENT
                                           }
                                           [ , ... ]

ALTER STREAMLIT [ IF EXISTS ] <name> RENAME TO <new_name>

ALTER STREAMLIT <name> COMMIT

ALTER STREAMLIT <name> PUSH [ TO <git_branch_uri> ]
  [
    {
      GIT_CREDENTIALS = <snowflake_secret>
      | USERNAME = <git_username> PASSWORD = <git_password>
    }
    NAME = <git_author_name>
    EMAIL = <git_author_email>
  ]
  [ COMMENT = <git_push_comment> ]

ALTER STREAMLIT <name> ABORT

ALTER STREAMLIT <name> PULL

ALTER STREAMLIT <name> ADD LIVE VERSION FROM LAST
ALTER STREAMLIT [ IF EXISTS ] <name> SET
  [ ROOT_LOCATION = '<stage_path_and_root_directory>' ]
  [ MAIN_FILE = '<path_to_main_file>']
  [ QUERY_WAREHOUSE = <warehouse_name> ]
  [ COMMENT = '<string_literal>']
  [ TITLE = '<app_title>' ]
  [ IMPORTS = ( '<stage_path_and_directory_or_file_name_to_read>' [ , ... ] ) ]
  [ EXTERNAL_ACCESS_INTEGRATIONS = ( <integration_name> [ , ... ] ) ]

ALTER STREAMLIT [ IF EXISTS ] <name> RENAME TO <new_name>

Parameters

NameRequiredDescription
nameIdentifier for the Streamlit object. If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.
SET ...Specifies the property to set for the Streamlit object: Warehouse runtimes: The file must be in the root of the source directory specified in FROM. Only a filename is allowed, not a path. Container runtimes: The file can be in the root or a subdirectory. You can specify a relative path from the root of the source directory, like 'subdir/my_app.py'. If your app was created with ROOT_LOCATION instead of FROM, then MAIN_FILE can be a path relative to ROOT_LOCATION even though ROOT_LOCATION only supports warehouse runtimes.
MAIN_FILE = 'filename'Specifies the Streamlit entrypoint file. The requirements depend on the runtime type:
QUERY_WAREHOUSE = warehouse_nameSpecifies the warehouse used by the Streamlit app. The behavior depends on the runtime type: Warehouse runtimes: Specifies the warehouse to run the app code and execute SQL queries. This is the code warehouse. It’s recommended to manually switch to a different warehouse within your app code for queries. Container runtimes: Specifies the warehouse to execute SQL queries issued by the app. The app code runs on the compute pool specified by COMPUTE_POOL.
RUNTIME_NAME = 'runtime_name'Specifies the runtime environment for the Streamlit app. Use this to change the runtime from warehouse to container or from container to warehouse. Warehouse runtime: Run the app in a virtual warehouse. Each viewer gets a personal instance of the app. Use SYSTEM$WAREHOUSE_RUNTIME. The Python version is selected separately using the environment.yml file. Container runtimes: Run the app in a Snowpark Container Services compute pool. All viewers share a single, long-running instance of the app. Container runtime names include the Python version. The following container runtimes are valid: SYSTEM$ST_CONTAINER_RUNTIME_PY3_11 Important When changing from a warehouse runtime to a container runtime, you must also set the COMPUTE_POOL parameter as appropriate. Container runtimes require a compute pool.
COMPUTE_POOL = compute_pool_nameSpecifies the compute pool where the Streamlit app runs. This parameter is required when using a container runtime and is ignored for warehouse runtimes.
COMMENT = 'string_literal'Adds a comment or overwrites an existing comment for the Streamlit object.
TITLE = 'app_title'Adds a title for the Streamlit app to display in Snowsight.
IMPORTS = ( 'stage_path_and_directory_or_file_name_to_read' [ , ... ] )The location (stage), path, and name of the directory or file(s) to import. This only applies to warehouse runtimes and is ignored for container runtimes.
EXTERNAL_ACCESS_INTEGRATIONS = ( integration_name [ , ... ] )The names of external access integrations needed in order for the Streamlit app code to access external networks. For container runtimes, external access integrations are required to install packages from external package indexes like PyPI. For all runtime types, external access integrations enable the app to make outbound network requests.
SECRETS = ( 'snowflake_secret_name' = snowflake_secret [ , ... ] )Maps Snowflake secrets to secret names that can be referenced in the Streamlit app code. The secret name (left side) is how you reference the secret in your code, and the secret object (right side) is the identifier of the Snowflake secret. For example: SECRETS = ('api_key' = my_database.my_schema.my_secret) In warehouse runtimes, secrets are accessed through the _snowflake module. In container runtimes, secrets are accessible through st.secrets and are also mapped to environment variables. Secrets must be associated with an external access integration in EXTERNAL_ACCESS_INTEGRATIONS. For more information, see Manage secrets and configure your Streamlit app.
ROOT_LOCATION = 'stage_path_and_root_directory'Specifies the root stage name and prefix containing the Streamlit Python files, media files, and environment.yml file. This parameter must point to a single directory inside a named internal stage.
UNSET ...Specifies one or more properties to unset for the Streamlit object, which resets them to their defaults: SECRETS EXTERNAL_ACCESS_INTEGRATIONS QUERY_WAREHOUSE TITLE COMMENT
RENAME TO new_nameSpecifies the new identifier for the Streamlit object. The identifier must be unique for the schema where the object was created. For more details about identifiers, see Identifier requirements.
COMMITCommits the pending edits in the LIVE version to a new LAST version. Immediately after the commit, the LIVE version is identical to the LAST version. Preview Feature — Open Available to all accounts.
PUSHPushes the latest committed changes to the Git repo, using the branch stored in the base version if TO git_branch_uri is not specified. If the base version is not based on a Git branch, this throws an error. Preview Feature — Open Available to all accounts.
TO git_branch_uriPushes committed changes to the specified branch.
GIT_CREDENTIALS = snowflake_secretSpecifies the Snowflake secret containing the credentials to use for authenticating with the repository.
USERNAME = git_usernameSpecifies a Git username.
PASSWORD = git_passwordSpecifies a Git password.
NAME = git_author_nameSpecifies the name of the git author to use.
EMAIL = git_author_emailSpecifies a valid e-mail address to use as the git author’s name.
COMMENT = git_push_commentSpecifies a comment to include in the git push.
ABORTRemoves the current live version of the app, including all edits made in Snowsight that have not been committed. Preview Feature — Open Available to all accounts.
PULLPulls latest changes. You must abort the current live version before pulling. Preview Feature — Open Available to all accounts.
ADD LIVE VERSION FROM LASTCreates a new live version of the app based on the last committed version. When the owner of a Streamlit app opens the app in Snowsight and a live version doesn’t exist, this command is executed automatically. If a different user visits the app and a live version doesn’t exist, an error is returned.

Usage notes

Access control requirements

If your role does not own the objects in the following table, then your role must have the listed privileges on those objects: Privilege | Object | Notes OWNERSHIP | Streamlit object that you alter | USAGE | Warehouse used by the Streamlit app | This privilege is only required if you set a new value for QUERY_WAREHOUSE. USAGE | Compute pool used by the Streamlit app | This privilege is only required if you set a new value for COMPUTE_POOL. USAGE | External access integrations used by the Streamlit app | This privilege is only required if you set a new value for EXTERNAL_ACCESS_INTEGRATIONS. USAGE | Secrets used by the Streamlit app | This privilege is only required if you set a new value for SECRETS. Operating on an object in a schema requires at least one privilege on the parent database and at least one privilege on the parent 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.

Known gaps

Parts not fully supported, and recorded divergences from Snowflake.

See also

Referenced by