Skip to content

Commit 8dc0366

Browse files
committed
add docs on native apps
1 parent 086b349 commit 8dc0366

File tree

1 file changed

+98
-0
lines changed
  • content/en/user-guide/native-apps

1 file changed

+98
-0
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
title: "Native Apps"
3+
linkTitle: "Native Apps"
4+
weight: 18
5+
description: Get started with Native Apps in LocalStack for Snowflake
6+
---
7+
8+
## Introduction
9+
10+
Snowflake Native Apps are applications built and executed directly within the Snowflake Data Cloud platform. These apps can be used to extend the capabilities of Snowflake by integrating with external services, automating workflows, and building custom data applications. These apps are developed using Snowflake-native tools (e.g., Snowflake SQL, Snowflake API, and JavaScript) and can be distributed on the Snowflake Marketplace.
11+
12+
The Snowflake emulator supports CRUD operations for Native Apps, allowing you to create, read, update, and delete apps using the same commands and syntax as the Snowflake service. The following operations are supported:
13+
14+
- [`CREATE APPLICATIONS`](https://docs.snowflake.com/en/sql-reference/sql/create-application.html)
15+
- [`SHOW APPLICATION PACKAGES`](https://docs.snowflake.com/en/sql-reference/sql/show-application-packages.html)
16+
- [`ALTER APPLICATION PACKAGE`](https://docs.snowflake.com/en/sql-reference/sql/alter-application-package.html)
17+
- [`DESCRIBE APPLICATION PACKAGE`](https://docs.snowflake.com/en/sql-reference/sql/describe-application-package.html)
18+
- [`DROP APPLICATION PACKAGE`](https://docs.snowflake.com/en/sql-reference/sql/drop-application-package.html)
19+
20+
## Getting started
21+
22+
This guide is designed for users new to Native Apps and assumes basic knowledge of SQL and Snowflake. Start your Snowflake emulator and connect to it using an SQL client in order to execute the queries further below.
23+
24+
In this guide, you will createan Application Package, add a version to your Application Package using a manifest file, create a Native Application from that package, view and describe your Native Applications, and clean up by dropping applications and packages.
25+
26+
### Create an Application Package
27+
28+
An Application Package is a container that can hold multiple versions of your Native App code and metadata. Use the `CREATE APPLICATION PACKAGE` statement:
29+
30+
```sql
31+
CREATE OR REPLACE APPLICATION PACKAGE my_first_package;
32+
```
33+
34+
You can view all existing Application Packages in your environment using the `SHOW APPLICATION PACKAGES` statement:
35+
36+
```sql
37+
SHOW APPLICATION PACKAGES;
38+
```
39+
40+
### Prepare a Manifest File
41+
42+
A manifest file describes your Native App version (e.g., name, version, comment). You typically store the manifest in a stage so that Snowflake can access it easily when creating a new app version.
43+
44+
Create your `manifest.yml` locally:
45+
46+
```yml
47+
manifest_version: 1
48+
version:
49+
name: v1
50+
comment: "My first native application"
51+
```
52+
53+
You can then upload the manifest file to a stage:
54+
55+
```sql
56+
PUT file://./manifest.yml @my_stage AUTO_COMPRESS=FALSE;
57+
```
58+
59+
### Add a Version to Your Application Package
60+
61+
Once your manifest (and any related files) are uploaded to a stage, you can register a version with the Application Package using the `ALTER APPLICATION PACKAGE` statement:
62+
63+
```sql
64+
ALTER APPLICATION PACKAGE my_first_package
65+
ADD VERSION v1
66+
USING '@my_stage';
67+
```
68+
69+
After adding a version, you can optionally set it as the default release directive:
70+
71+
```sql
72+
ALTER APPLICATION PACKAGE my_first_package
73+
SET DEFAULT RELEASE DIRECTIVE VERSION = v1 PATCH = 0;
74+
```
75+
76+
Use `SHOW APPLICATION PACKAGES` again to see details of your updated package:
77+
78+
```sql
79+
SHOW APPLICATION PACKAGES LIKE 'MY_FIRST_PACKAGE';
80+
```
81+
82+
### Create a Native Application from the Package
83+
84+
Next, create a Native Application that references the versioned Application Package you just set up using the `CREATE APPLICATION` statement:
85+
86+
```sql
87+
CREATE OR REPLACE APPLICATION my_native_app
88+
FROM APPLICATION PACKAGE my_first_package;
89+
```
90+
91+
### Clean up
92+
93+
When you no longer need your Native Application or its package, you can drop them using the `DROP APPLICATION` and `DROP APPLICATION PACKAGE` statements:
94+
95+
```sql
96+
DROP APPLICATION my_native_app;
97+
DROP APPLICATION PACKAGE my_first_package;
98+
```

0 commit comments

Comments
 (0)