ALTER STREAMLIT

Modifies the properties of an existing Streamlit object.

See also:

CREATE STREAMLIT, SHOW STREAMLITS, DESCRIBE STREAMLIT, DROP STREAMLIT

Syntax

ALTER STREAMLIT [ IF EXISTS ] <name> SET
  [ MAIN_FILE = '<filename>']
  [ QUERY_WAREHOUSE = <warehouse_name> ]
  [ COMMENT = '<string_literal>']
  [ TITLE = '<app_title>' ]
  [ IMPORTS = ( '<stage_path_and_file_name_to_read>' [ , ... ] ) ]
  [ EXTERNAL_ACCESS_INTEGRATIONS = ( <integration_name> [ , ... ] ) ]

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
Copy

For Streamlit objects created with ROOT_LOCATION, only the following syntax is supported:

Important

ROOT_LOCATION is a legacy parameter and may be deprecated in a future release. For Streamlit apps created using ROOT_LOCATION, multi-file editing and Git integration are not supported.

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_file_name_to_read>' [ , ... ] ) ]
  [ EXTERNAL_ACCESS_INTEGRATIONS = ( <integration_name> [ , ... ] ) ]

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

Parameters

name

Identifier 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:

MAIN_FILE = 'filename'

Specifies the filename of the Streamlit entrypoint file. The file must be in the root of the app’s directory and include the .py extension.

If your app was created with ROOT_LOCATION instead of FROM, then MAIN_FILE can be a path relative to ROOT_LOCATION.

QUERY_WAREHOUSE = warehouse_name

Specifies the warehouse where SQL queries issued by the Streamlit application are run.

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_file_name_to_read' [ , ... ] )

The location (stage), path, and name of the file(s) to import.

EXTERNAL_ACCESS_INTEGRATIONS = ( integration_name [ , ... ] )

The names of external access integrations needed in order for the Streamlit app code to access external networks.

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.

RENAME TO new_name

Specifies 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.

COMMIT

Commits 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.

PUSH

Pushes 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.

TO git_branch_uri

Pushes committed changes to the specified branch.

GIT_CREDENTIALS = snowflake_secret

Specifies the Snowflake secret containing the credentials to use for authenticating with the repository.

USERNAME = git_username

Specifies a Git username.

PASSWORD = git_password

Specifies a Git password.

NAME = git_author_name

Specifies the name of the git author to use.

EMAIL = git_author_email

Specifies a valid e-mail address to use as the git author’s name.

COMMENT = git_push_comment

Specifies a comment to include in the git push.

ABORT

Removes the current live version of the app, including all edits made in Snowsight that have not been committed.

PULL

Pulls latest changes. You must abort the current live version before pulling.

ADD LIVE VERSION FROM LAST

Creates 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.

Access control requirements

Your role must have the following privileges on objects:

Privilege

Object

OWNERSHIP

Streamlit object that you alter

The USAGE privilege on the parent database and schema are required to perform operations on any object in a schema. Note that a role granted any privilege on a schema allows that role to resolve the schema. For example, a role granted CREATE privilege on a schema can create objects on that schema without also having USAGE granted on that 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

  • If you remove the live version of the app, a user can’t visit the app until you do one of the following actions:

    • Execute ALTER STREAMLIT … ADD LIVE VERSION FROM LAST on the Streamlit object.

    • Visit the app in Snowsight with the role that owns the app.

  • If you run the ALTER STREAMLIT command while the Streamlit app is running, the app does not reflect the changes that you made.

    If you want your changes reflected in the app, you must reload or reboot the app.

  • 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.