Snowflake Native Applications
1. Snowflake Native Applications
With Streamlit in Snowflake, you're able to quickly build an application that was easily shared with other users in your Snowflake account. With Snowflake native applications, the model of sharing an app extends beyond your Snowflake account. Let's take a look at how this is done. Snowflake native applications are fully contained applications that run entirely within a Snowflake account. Apps are built by application providers and listed on the Snowflake marketplace. There, app consumers can discover, install, and run native apps in their Snowflake account. The flow is very similar to the flow for discovering and loading datasets from the Snowflake marketplace. Native apps are a phenomenal way of delivering a data product like a dataset, a machine learning model, and more. Snowflake native apps are typically built with Snowflake as the core application stack. You'll use SQL, Snowpark, Streamlit, and Snowflake as your datastore as the core components of your applications. But the great thing is that if you're looking to build something even more custom within your app, you can leverage Snowpark container services and run a container image within your Snowflake native app instead. Just like Streamlit in Snowflake, you can also bring in other open-source libraries as well. Once an application is ready to be shared, application providers bundle the application into an application package and distribute it on the Snowflake marketplace as either a public or private listing, perhaps with a billing model. When a consumer installs an application in their Snowflake account, they power the application using their compute resources. The application is then able to act on objects within the consumer's account provided that the consumer has granted the application permission to access those objects. Consumers are always able to manage any and all permissions from within the application. Follow along with me as we take existing application code and bundle it up as a Snowflake native application. We'll take the same application that we built in the prior video and deploy it as a native app using the Snowflake CLI. Now's a good time to pause the video if you need to log into your Snowflake account. Using the terminal, cd into the Snowflake native app folder within the module four folder of the repo. In here, you'll find a folder called Hamburg weather native app. This folder contains all of the code for the native app that we'll deploy into your Snowflake account. Again, we'll deploy the same Streamlit app we built earlier, but this time as a Snowflake native app. You can imagine that in this scenario, we're sharing insights on proprietary data safely and securely to interested consumers via our native app. Let's take a look at how things are organized in this folder. The core components are the Streamlit.py, Manifest.yaml, and SetupScript.sql files. The Streamlit file defines the front end of the app, which mostly contains the same code as the Streamlit in Snowflake app that we built. The Manifest file defines properties required by the application package, including the location of the SetupScript. The SetupScript file is what's executed when the application is installed into a consumer's account. This is a fully working native app that's ready to be deployed. Now, there are some other files in this repo, but we won't be able to do a deep dive into the Snowflake native application framework in this video. What I'd like for you to focus on is not necessarily the exact setup or specific components of the Snowflake native app, but rather the high-level concepts of creating an application, bundling it up, and deploying it to a consumer's account. To that end, we'll use a Snowflake CLI to deploy and install the application to our account. In the terminal, cd into the Hamburg weather native app folder. Next, type `snow app run`. This command bundles the application's logic into an application package and installs the application in your account. After a few seconds, you should see successful output along with a handy link that you can click on to get directly to the app. Click on it. You'll be taken to the application running in your Snowflake account. Remember, this is what a consumer would see after installing and running the application in their account. We're simply using one account for the purposes of convenience. For just a moment, you should imagine that you're a consumer that discovered this application on the marketplace and installed it into your account. You'll be prompted to give the application access to the weather Hamburg T table when the app first boots up. Use a UI to grant access. Great. Now, the application will boot up and render the front end defined in the stream of file. Excellent. If you want to quickly uninstall the application and drop the application package, you can run Snow app teardown within the Hamburg weather native app folder. Before we close out, let's quickly go over some key differences between Streamlit in Snowflake apps and Snowflake native applications. Streamlit in Snowflake apps are typically bound to accounts. They are deployed in a specific Snowflake account, and you can share the app with team members in your account. With Snowflake native applications, you can publicly list an app on the marketplace, making it discoverable to all users within Snowflake's data Cloud. Snowflake native applications run in consumer accounts, and consumers power the application with their accounts data and compute resources. Snowflake native apps are a phenomenal way to go beyond the boundaries of your own Snowflake account and share business logic with consumers in Snowflake's data Cloud. Coming up, we'll recap all that you've learned about data delivery.2. Let's practice!
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.