EXECUTE NOTEBOOK

statementsupportedContainer services & dev tooling

docs.snowflake.com ↗

Executes the notebook outside the Notebook Editor. For example, you can run EXECUTE NOTEBOOK by itself from a worksheet, nest it within another Snowflake executable such as a stored procedure or task, or use it in a third-party orchestrator. The command runs the latest code from all cells in the notebook. Results are accessible from the Notebook Editor. Note EXECUTE NOTEBOOK also requires the QUERY_WAREHOUSE parameter to be set, otherwise an error occurs. To set the QUERY_WAREHOUSE parameter, use the ALTER NOTEBOOK command.

Syntax

EXECUTE NOTEBOOK <name>([ <parameter_string> [ , ... ] ]);

Parameters

NameRequiredDescription
namerequiredSpecifies the identifier (i.e. name) for the notebook; must be unique for the schema in which the notebook is created. Must be fully qualified if the notebook is not stored in the current database.schema you are operating in. In addition, the identifier must start with an alphabetic character and cannot contain spaces or special characters unless the entire identifier string is enclosed in double quotes (for example, “My object”). Identifiers enclosed in double quotes are also case-sensitive. For more information, see Identifier requirements.
parameter_stringoptionalOptionally pass in arguments to a notebook. In a Python cell in the notebook, you can access these arguments by using the sys.argv variable. Only strings are supported; other data types (such as integers or booleans) are interpreted as NULL.

Usage notes

Access control requirements

A role used to execute this operation must have the following privileges at a minimum: Privilege | Object | Notes OWNERSHIP | Notebook | 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). 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.

Example

The following example triggers the default version of the specified notebook without passing in any arguments:

Referenced by