/streamlit

Getting Started With Snowpark for Python and Streamlit on Platform.sh

Primary LanguagePython

Deploy on Platform.sh

Snowpark and Streamlit by Snowflake

This template provides the most basic configuration for getting started with snowpark for Python and streamlit on Platform.sh.

Features

  • Python 3.8
  • Automatic TLS certificates

Customizations

The following files are of particular importance. If using this project as a reference for your own existing project, replicate the changes below to your project.

  • The .platform.app.yaml, .platform/services.yaml, and .platform/routes.yaml files have been added. These provide Platform.sh-specific configuration and are present in all projects on Platform.sh. You may customize them as you see fit.

Configure your environment

Once you deployed a new platform.sh project out of this template, you will need to set up some environment variables for it work correctly. They are being used in this piece of code:

connection_parameters = {
    "account": os.getenv("SNOW_ACCOUNT_ID"),
    "user": os.getenv("SNOW_USER"),
    "password": os.getenv("SNOW_PASSWORD"),
    "role": os.getenv("SNOW_ROLE"),
    "warehouse": os.getenv("COMPUTE_WH"),
    "database": os.getenv("SNOW_DATABASE"),
    "schema": os.getenv("SNOW_SCHEMA")
}
  • To set SNOW_ACCOUNT_ID you can use your account name
  • To set SNOW_USER get the username from your Snowflake profile
  • To set SNOW_PASSWORD use your account's password

These variables can be set using the platform.sh CLI or the Web Console.

The remainder of the environment variables is set in code (in the .platform.app.yaml) as they currently hold non-sensitive data.

References