Common Setup for Snowpark Container Services Tutorials¶
Introduction¶
This topic provides instructions for the common setup required for all Snowpark Container Services tutorials provided in this documentation.
Configure prerequisites¶
Review the following prerequisites to ensure you can complete the tutorials:
- A Snowflake account: Note that trial accounts are not supported.
- SnowSQL, the command-line client for executing SQL commands (optional): You can use any Snowflake client that supports executing SQL commands and uploading files to a Snowflake stage. The tutorials are tested using the SnowSQL and the Snowsight web interface. For instructions to install this command-line client, see Installing SnowSQL.
- Docker Desktop: These tutorials provide instructions for using Docker Desktop. For installation instructions, see https://docs.docker.com/get-docker/ (https://docs.docker.com/get-docker/). Note that you can use any OCI-compliant clients to create images, such as Docker, Podman, or Nerdctl.
Create Snowflake objects¶
Execute the SQL provided using either the SnowSQL or the Snowsight.
-
Login to Snowflake as a user with the ACCOUNTADMIN role.
-
Using the ACCOUNTADMIN role, execute the following script, replacing
user_namewith the name of your Snowflake user who will test the tutorials. For these tutorials, you might choose the same user who executes this script or another user in your Snowflake account. The script does the following:- Creates a role (
test_role) and other Snowflake objects. To create the role and objects, you must use the ACCOUNTADMIN role. (This restriction helps to control costs and manage business information risks.) The script also grants thetest_rolerole the privileges needed to manage the newly created objects. - Grants the role to the specified Snowflake user, who then uses the role to explore the tutorials.
Note that:
-
You create a warehouse because the services (including job services) can run SQL DML statements (such as SELECT and INSERT). Snowflake executes these statements in the warehouse.
-
In tutorial 1, you create a service that exposes an endpoint as public to allow users to access the service from the public web (ingress). To create this service:
- The role
test_rolemust have the BIND SERVICE ENDPOINT privilege on the account. - The current implementation requires a security integration, which the script creates.
- The role
-
A compute pool is a collection of one or more virtual machine (VM) nodes on which Snowflake runs your services.
- Creates a role (
-
Make sure you are logged in to Snowflake as the user specified in the preceding script.
-
Using the
test_rolerole, execute the following script to create database-scoped objects common to all the tutorials.Note that:
- You create an image repository to store your service code (container images).
- You create a Snowflake stage to store your service specification files in tutorial 2 and 3.
Verify that you are ready to continue¶
-
To verify that you have the objects needed for the tutorials, execute the following commands:
-
To verify that you have your account information (organization and account names), use one of the following methods:
-
Find the information on the Snowsight web interface, in the lower left corner of the Home page.
-
In the SnowSQL CLI, execute SHOW IMAGE REPOSITORIES. The command returns the repository URL, including the organization and account names.
Example
-
What’s next?¶
You can now explore Tutorial 1.