CREATE STREAMLIT

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>' ]
  [ TITLE = '<app_title>' ]
  [ IMPORTS = ( '<stage_path_and_file_name_to_read>' [ , ... ] ) ]
  [ EXTERNAL_ACCESS_INTEGRATIONS = ( <integration_name> [ , ... ] ) ]
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.

  • External stages are not supported for Streamlit in Snowflake.

  • If you’re creating or replacing a Streamlit application object within the Snowflake Native App Framework, use FROM 'relative_path_from_stage_root_directory' and not ROOT_LOCATION = 'stage_path_and_root_directory'.

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

TITLE = 'app_title'

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

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
Language: English