CREATE STREAMLIT

Attention

This feature is available to accounts in AWS, Microsoft Azure, and GCP regions. AWS PrivateLink and Azure Private Link are not supported.

Creates a new Streamlit application object in Snowflake or replaces an existing Streamlit application object in the same schema.

See also:

SHOW STREAMLITS, DESCRIBE STREAMLIT, ALTER STREAMLIT, DROP STREAMLIT

Syntax

CREATE [ OR REPLACE ] STREAMLIT [ IF NOT EXISTS ] <name>
  ROOT_LOCATION = '<stage_path_and_root_directory>'
  MAIN_FILE = '<path_to_main_file_in_root_directory>'
  [ QUERY_WAREHOUSE = <warehouse_name> ]
  [ COMMENT = '<string_literal']
Copy

Required parameters

name

Specifies the identifier (i.e. name) for the Streamlit object. This identifier must be unique for the schema in which the table is created.

In addition, the identifier must start with an alphabetic character and cannot contain spaces or special characters unless the entire identifier string is enclosed in double quotes (e.g. "My object"). Identifiers enclosed in double quotes are also case-sensitive.

For more details, see Identifier requirements.

ROOT_LOCATION = 'stage_path_and_root_directory'

Specifies the full path to the named stage containing the Streamlit Python files, media files, and the environment.yml file, for example:

ROOT_LOCATION = '@streamlit_db.streamlit_schema.streamlit_stage'
Copy

In this example, the Streamlit files are located on a named stage named streamlit_stage within a database named streamlit_db and schema named streamlit_schema.

Note

This parameter must point to a single directory inside a named internal stage.

MAIN_FILE = 'path_to_main_file_in_root_directory'

Specifies the filename of the Streamlit Python application. This filename is relative to the value of ROOT_LOCATION.

Optional parameters

QUERY_WAREHOUSE = warehouse_name

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

COMMENT = 'string_literal'

Specifies a comment for the Streamlit object.

DEFAULT: No value

Usage notes

  • All files in the directory specified by ROOT_LOCATION are available to the Streamlit runtime. This includes the Python source file, environment.yml and media files.

  • When you clone a schema or database containing a Streamlit object, the Streamlit object is not cloned.

  • To specify the packages used by the Streamlit application, use an environment.yml in the root location.

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

  • CREATE OR REPLACE <object> statements are atomic. That is, when an object is replaced, the old object is deleted and the new object is created in a single transaction.

Examples

To create a STREAMLIT object, run the CREATE STREAMLIT command, as shown in the following example:

CREATE STREAMLIT hello_streamlit
ROOT_LOCATION = '@streamlit_db.streamlit_schema.streamlit_stage'
MAIN_FILE = '/streamlit_main.py'
QUERY_WAREHOUSE = my_warehouse;
Copy