EXECUTE DCM PROJECT¶
Executes one of the following actions on a DCM project:
EXECUTE DCM PROJECT <name> PLANperforms a dry run of the DCM project to analyze the changes that would be applied to the target during a deployment, but doesn’t apply any changes.EXECUTE DCM PROJECT <name> DEPLOYdeploys the changes defined in the project’s definition files to the account.EXECUTE DCM PROJECT <name> REFRESH ALLrefreshes dynamic tables managed by the DCM project.EXECUTE DCM PROJECT <name> TEST ALLtests all expectations from attached data metric functions managed by the DCM project.EXECUTE DCM PROJECT <name> PREVIEWreturns a data sample of the current definitions specified in the source path for the specified table, view, or dynamic table.
- See also:
CREATE DCM PROJECT, ALTER DCM PROJECT, DESCRIBE DCM PROJECT, DROP DCM PROJECT, SHOW DCM PROJECTS, SHOW DEPLOYMENTS IN DCM PROJECT
Syntax¶
Required parameters¶
nameSpecifies the identifier for the DCM project to execute.
If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.
For more information, see Identifier requirements.
PLANInstructs Snowflake to perform a dry run of the DCM project. For a dry run, Snowflake analyzes the changes that would be applied to the target during a deployment, but doesn’t apply any changes.
DEPLOY [ AS 'deployment_name_alias' ]Deploys the changes defined in the project’s definition files to the account; optionally specifies an alias for the deployment.
FROM 'source_files_path'Specifies the directory that contains the source files for the DCM project. The directory must contain a manifest file and at least one definition file in
/sources/definitions/. The manifest file provides the templating values in case a configuration was specified.REFRESH ALLRefreshes all dynamic tables that are currently managed by the DCM project.
TEST ALLTests all data quality expectations attached to tables, dynamic tables, or views which are currently managed by the DCM project.
PREVIEW fully_qualified_table_object_nameReturns a data sample of the current definitions specified in the source path for the specified table, view, or dynamic table - independent of any deployed state.
Optional parameters¶
USING CONFIGURATION config_nameSpecifies the configuration to use. This lets you customize deployments for different environments, such as development, staging, or production, without using different project definition files.
If the configuration name is not in all uppercase, enclose it in double quotes.
USING ( expr [, expr , ... ] )Optionally specifies template variable values. Using this option overrides any default or configuration values for this specific variable. The single expression must have the following form:
<variable_name> => <variable_value>. For lists, use the following form:<variable_name> => [<value1>, <value2>, ...]. For example:wh_size => 'MEDIUM'orteams => ['TEAM_A', 'TEAM_B'].This lets you customize deployments for different environments, such as development, staging, or production, without using different project definition files.
Access control requirements¶
A role used to execute this operation must have the following privileges at a minimum:
Privilege |
Object |
Notes |
|---|---|---|
OWNERSHIP |
DCM project |
OWNERSHIP is a special privilege on an object that is automatically granted to the role that created the object, but can also be transferred using the GRANT OWNERSHIP command to a different role by the owning role (or any role with the MANAGE GRANTS privilege). |
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.
Output¶
After the DCM project executes, this command returns the following output depending on the variation:
PLAN and DEPLOY: A single row containing a JSON object with the change log
PREVIEW: A resultset
REFRESH ALL: A single row containing a JSON object that contains the full response.
TEST ALL: A single row containing a JSON object that contains the full response.
Usage notes¶
When executing a DCM project with EXECUTE DCM PROJECT PLAN, the output of the command is the same as for the actual deployment. The difference is that no changes to the affected account are applied. This feature allows you to verify whether the rendered definition files have a valid syntax, what changes would be applied to the account, and wether the project owner role has the required privileges to apply these changes.
To avoid unintended changes and catch errors, always run EXECUTE DCM PROJECT PLAN before you deploy a DCM project.
Support for template variables¶
Template variables let you dynamically choose the content of the parameterized definitions files during the DCM project execution. You can use template variables in the following ways:
See the Template variable examples section for examples.
Examples¶
Basic examples¶
Execute a DCM project in PLAN mode to validate changes to a project without applying them:
Execute a DCM project in DEPLOY mode (to apply changes) to specify a deployment alias and a configuration named PROD:
Template variable examples¶
The following examples demonstrate how you can specify the value for template variables in an EXECUTE DCM PROJECT statement.
Override the template variable defined in the DCM project’s manifest file
Define a template variable named
descin the manifest file:Create a definition file that uses the template variable:
Call the EXECUTE DCM PROJECT command in DEPLOY mode, and specify a value for the
descvariable to override its default value in the manifest:
Provide a value for a template variable not defined in the manifest file
Create a definition file with the desired commands:
Call the EXECUTE DCM PROJECT command, and specify a value for the
desc_newvariable: