- Categories:
CODE_ BUNDLE_ HISTORY¶
Returns the run history of Code Bundles: one row per run of
EXECUTE CODE BUNDLE or EXECUTE NOTEBOOK PROJECT,
including anonymous runs (EXECUTE CODE BUNDLE FROM ...) and runs submitted through the REST API. All arguments are optional and act as
filters. With no arguments, the function returns the most recent runs, up to RESULT_LIMIT.
Use this function to check whether a run succeeded, find a run by its query ID or execution name, and review failures.
Syntax¶
Arguments¶
All arguments are optional.
BUNDLE_NAME => '<string>'Name of the Code Bundle to return runs for. You can specify a fully qualified name (
database.schema.bundle) or a bare name combined withDATABASEandSCHEMA.DATABASE => '<string>'Database used to resolve a bare
BUNDLE_NAME, or to return runs of Code Bundles in that database. Ignored whenBUNDLE_NAMEis fully qualified.SCHEMA => '<string>'Schema used to resolve a bare
BUNDLE_NAME, or to return runs of Code Bundles in that schema. Ignored whenBUNDLE_NAMEis fully qualified.ENTRYPOINT => '<string>'Returns only runs whose entrypoint matches this value exactly (for example,
main.py,main.py:run, orcom.example.MyApp).START_TIME_RANGE_START => <constant_expr>,START_TIME_RANGE_END => <constant_expr>TIMESTAMP_LTZvalues that bound the start time of the returned runs. Both ends are inclusive.BUNDLE_TYPES => '<string>'Comma-separated, case-insensitive list of bundle types to include:
custom,spark, andml.COMPUTE_TYPES => '<string>'Comma-separated, case-insensitive list of compute types to include:
warehouseandcompute_pool.LANGUAGE_TYPES => '<string>'Comma-separated, case-insensitive list of languages to include:
python,java, andscala.STATUS => '<string>'A single status to filter by:
pending,running,done(orsucceeded),failed,cancelled(orcanceled), ordeleted.These filter values aren’t the same as the values in the
STATUScolumn. For example, a successful run hasSTATUSDONE.EXECUTION_NAME => '<string>'Returns only runs whose
EXECUTION_NAME, set with EXECUTE CODE BUNDLE, matches this value exactly.QUERY_ID => '<string>'Returns the run started by the statement with this query ID. The query ID of an
EXECUTE CODE BUNDLEstatement identifies its run. It’s the same value as thejob_idreturned by a REST submission.RESULT_LIMIT => <integer>Maximum number of rows to return. Default:
100. Values are limited to the range 1 to 1000.PAGE_TOKEN => '<string>'Returns the runs after the row that the token came from. To get the next page of results, pass the
PAGE_TOKENvalue from the last row of the previous call, with the same filters.
Output¶
The function returns one row per run, with the following columns:
| Column | Description |
|---|---|
CODE_BUNDLE_NAME | Name of the Code Bundle. NULL for an anonymous run. |
DATABASE_NAME | Database of the Code Bundle. NULL for an anonymous run. |
SCHEMA_NAME | Schema of the Code Bundle. NULL for an anonymous run. |
ENTRYPOINT | Entrypoint of the run. |
STATUS | State of the run, for example DONE or FAILED. |
RUNTIME_STATUS_DETAILS | Additional status details from the runtime, if any. |
SQL_ERROR_CODE | Snowflake error code of a failed run. |
ERROR_MESSAGE | Error message of a failed run. |
BUNDLE_TYPE | Bundle type of the run, for example SPARK. |
COMPUTE_TYPE | Compute type that the run used: WAREHOUSE or COMPUTE_POOL. |
LANGUAGE_TYPE | Language of the run, for example PYTHON or SCALA. |
RUNTIME_NAME | Name of the runtime that ran the code: the warehouse name, or the name of the service on the compute pool. |
START_TIME | Time when the run started. |
END_TIME | Time when the run finished. NULL while the run is in progress. |
QUERY_ID | Query ID of the statement that started the run. |
EXECUTION_NAME | Execution name set for the run, if any. |
RUNTIME_VERSION | Runtime version that the run used, for example the Python version on a warehouse or the Container Runtime version on a compute pool. |
TASK_NAME | Fully qualified name of the task that started the run. NULL if the run wasn’t started by a task. |
PAGE_TOKEN | Continuation token for the next page of results. Pass it as the PAGE_TOKEN argument to get the runs after this row. |
Usage notes¶
- Call the function as
SNOWFLAKE.INFORMATION_SCHEMA.CODE_BUNDLE_HISTORY, or qualify it with a database that you can access, such asmy_db.INFORMATION_SCHEMA.CODE_BUNDLE_HISTORY. If you call it unqualified and your session has no current database, the query fails. - The runs that you can see depend on your role’s privileges on the Code Bundle and your
IMPERSONATEprivilege on the user who started each run. For details, see Run history and result visibility. - An asynchronous run appears in the history after it starts. If a statement fails before the run starts, for example because the entrypoint doesn’t exist, the run doesn’t appear in the history; check the statement’s error instead.
Examples¶
Return the most recent runs of a Code Bundle:
Check the status of one run by its query ID:
Find failed Python runs on warehouses in the last day:
Find anonymous runs by execution name:
Get the next page of results by passing the PAGE_TOKEN value from the last row of the previous page: