CREATE APPLICATION SERVICE¶
Creates a new Application Service that deploys a packaged application build from an artifact repository.
An Application Service is a first-class Snowflake object. It manages its own compute, lifecycle, and access control. Unlike a Snowpark Container Services service, an Application Service deploys from a versioned package rather than from a user-supplied service specification.
- See also:
ALTER APPLICATION SERVICE , DESCRIBE APPLICATION SERVICE , DROP APPLICATION SERVICE , SHOW APPLICATION SERVICES
Syntax¶
Required parameters¶
nameSpecifies the identifier for the Application Service. The identifier must be unique for the schema where the service is created. For more details, see Identifier requirements.
The Application Service doesn’t share a namespace with SPCS
SERVICEobjects.PACKAGE package_nameSpecifies the name of the package in the artifact repository to deploy.
Optional parameters¶
FROM ARTIFACT REPOSITORY repository_nameSpecifies the artifact repository that contains the package to deploy. The repository must be of type
APPLICATION.If you omit this clause, Snowflake uses the default application artifact repository associated with the creating role.
VERSION version_aliasSpecifies the version of the package to deploy. You can pass a version name, such as
VERSION$3, or a version alias, such asLATESTorDEFAULT. If you don’t specify a version, Snowflake uses the package’s default version; if the package has no default version, the command returns an error.IN COMPUTE POOL compute_pool_nameSpecifies the Snowpark Container Services compute pool that runs the Application Service. The role that creates the service needs the
USAGEprivilege on the compute pool.If you omit this clause, the service uses a Snowflake-managed default compute pool when default compute pools are enabled for your account.
EXTERNAL_ACCESS_INTEGRATIONS = ( integration_name [ , ... ] )
Specifies the names of the external access integrations that allow the application to access external network locations. The names in this list are case-sensitive.
QUERY_WAREHOUSE = warehouse_nameSpecifies the warehouse used by the application when a container connects to Snowflake without explicitly specifying a warehouse.
AUTO_RESUME = { TRUE | FALSE }Specifies whether Snowflake automatically resumes the service when it receives an inbound request to one of its endpoints.
AUTO_SUSPEND_SECS = numSpecifies the number of seconds of inactivity after which Snowflake automatically suspends the Application Service. The minimum non-zero value is
300. A value of0disables auto-suspend.DEFAULT:
0(disabled)COMMENT = 'string_literal'Specifies a comment for the Application Service.
Access control requirements¶
If your role does not own the objects in the following table, then your role must have the listed privileges on those objects:
| Privilege | Object | Notes |
|---|---|---|
| CREATE APPLICATION SERVICE | Schema | Required to create a new Application Service in the schema. |
| READ | Artifact repository | Required on the artifact repository that contains the package. |
| USAGE | Compute pool | Required on the compute pool that runs the service, when you specify
|
| USAGE | External access integration | Required for each integration listed in EXTERNAL_ACCESS_INTEGRATIONS. |
| USAGE | Warehouse | Required if QUERY_WAREHOUSE is specified. |
Operating on an object in a schema requires at least one privilege on the parent database and at least one privilege on the parent schema.
For instructions on creating a custom role with a specified set of privileges, see Creating custom roles.
For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.
Usage notes¶
- The Application Service starts automatically after creation. To check its status, use SHOW APPLICATION SERVICES or DESCRIBE APPLICATION SERVICE.
- To upgrade the service to a different package version, use
ALTER APPLICATION SERVICE with
UPGRADE. - Naked SPCS SQL commands, such as
CREATE SERVICEandEXECUTE JOB SERVICE, aren’t used to manage an Application Service. UseAPPLICATION SERVICEcommands instead. CREATE OR REPLACEisn’t supported for Application Services.
- The OR REPLACE and IF NOT EXISTS clauses are mutually exclusive. They can’t both be used in the same statement.
-
CREATE OR REPLACE <object> statements are atomic. That is, when an object is replaced, the old object is deleted and the new object is created in a single transaction.
Examples¶
Deploy the default version of a package from the default artifact repository
(the common case when you use snow app deploy):
Deploy a specific version from a named repository onto a user-supplied compute pool:
Deploy the LATEST alias: