Use Streamlit in Snowflake to code in a secure environment

Snowflake is a single, global platform that powers the Data Cloud. If you want to use a secure platform with role-based access control, this is the option for you! This page walks you through creating a trial Snowflake account and building a simple "Hello world" app. Your trial account comes with an account credit so you can try out the service without entering any payment information.

push_pin

Note

Streamlit in Snowflake is currently based on Streamlit version 1.22.0 with some Limitations and unsupported features. We are working on supporting newer versions and more features.

All you need is an email address! Everything else happens in your 30-day trial account.

  1. Go to signup.snowflake.com. (This link will open in a new tab.)

  2. Fill in your information and click "CONTINUE."

  3. Select "Standard" for your Snowflake edition and "Amazon Web Services" for your cloud provider.

  4. Choose the region nearest you, accept the terms, and click "GET STARTED."

Choose your Snowflake edition, provider, and region
  1. Answer or skip a few questions to let us know more about yourself.

  2. A message will display to confirm "You're now signed up!" Go to your email and click on the activation link. (Within your link, note the subdomain. This is your Snowflake account identifier. https://<account_identifier>.snowflakecomputing.com)

  3. Set your username and password. This will be an admin user account within your Snowflake account. Your Snowflake account can have multiple users within it.

  4. If you are not signed in after setting your password, follow the instructions to enter your Snowflake account identifier before entering your username and password. If you've accidentally closed your browser, you can log in at app.snowflake.com.

  5. Congratulations! You have a trial Snowflake account. The first thing you will see are some sample databases. (This interface is called Snowsight. Check out the Snowflake docs for a quick tour.)

    Sample databases in your new trial Snowflake account
  1. In the left navigation, go to "Admin" then "Billing & Terms."

  2. In the "Anaconda" section, click "Enable."

  3. Accept the terms. The "Anaconda" section will now show "Acknowledged."

  1. Click on your name in the left navigation. Hover over "Switch Role" and select "ACCOUNTADMIN" to use your account in the context of an admin.

  2. In the left navigation under "Admin," click on "Warehouses."

  3. In the upper-right corner, click the blue "add Warehouse" button.

  4. Enter "STREAMLITWAREHOUSE" for the name and keep the defaults of "Standard" type and "X-Small" size. Click "Create Warehouse."

  5. In the left navigation, go to "Data" then "Databases." (This is back where you started!)

  6. In the upper-right corner, click the blue "add Database" button.

  7. Enter "STREAMLITAPPSDB" for the name. Click "Create."

  8. Yay! You now have a new database to hold all your Streamlit apps.

    New database in your new trial Snowflake account
  1. In the left navigation, click on "Streamlit."

  2. In the upper-right corner, click the blue "add Streamlit App" button.

  3. Enter "Hello World" for the name of your app. Your new warehouse and database should already be filled in, along with the "PUBLIC" schema for your database. Click "Create." (Note that the app will run with the rights of "ACCOUNTADMIN" for simplicity. You can curate your roles and permissions to choose who can create and access apps.)

    Create your first Streamlit in Snowflake app
  4. Your new app, prefilled with example code, will open in editing mode. The left panel shows your code. The right panel shows the resulting app.

  5. You can explore the example if you want, but we'll proceed here with a simpler example. (Don't worry! You can always make another app to get the same example again.) Delete the code on the left and replace it with:

    import streamlit as st st.write("Hello World")
  6. In the upper-right corner, click the blue "play_arrow Run" button to make the running app reflect your changes.

  7. Hooray! You just wrote a Streamlit app.

Hello World in Streamlit in Snowflake app
  1. Change st.write to st.title:

    import streamlit as st st.title("Hello World")
  2. In the upper-right corner, click the blue "play_arrow Run" button to make the running app reflect your changes.

  3. You've just edited your app. It's that easy.

    Hello World in Streamlit in Snowflake app
  4. When you're done, click "chevron_left Streamlit Apps" in the upper-left corner to go back to Snowsight.

  1. When you are ready to return to your app, go to your Snowsight interface. (If you are returning to the site, you can log in at app.snowflake.com.)

  2. In the left navigation, go to "Streamlit."

  3. Click on "Hello World." (If you don't see your app, check that you have your role set to "ACCOUNTADMIN" as above.)

    Return to your Streamlit in Snowflake app
  4. Your app will open in viewing mode. Just click "Edit" in the upper-right corner to modify your app again.

    Change to editing mode in Streamlit in Snowflake

Read about our Basic concepts and try out more commands in your app. To create more apps in your account, you can proceed from Create a "Hello World" Streamlit app. The warehouse and database setup do not need to be repeated.

For more information about creating and managing Streamlit in Snowflake apps, check out the Snowflake docs.

forum

Still have questions?

Our forums are full of helpful information and Streamlit experts.