GET_JOB_HISTORY

functionsupportedContainer services & dev tooling

docs.snowflake.com ↗

Table functions

Returns the job history for Snowpark Container Services jobs up to 30 days with an optional time range. The function returns both running and deleted jobs.

Syntax

supportedpartialnot supportednot scored

SNOWFLAKE.SPCS.GET_JOB_HISTORY(
  [ CREATED_TIME_START => <constant_expr> ],
  [ CREATED_TIME_END => <constant_expr> ],
  [ RESULT_LIMIT = <integer> ])

Parameters

NameRequiredDescription
CREATED_TIME_START => constant_exprrequiredStart time, in TIMESTAMP_LTZ format — for example, ’2024-04-05 01:02:03’ — for the time range when jobs were created to retrieve the job history. For available functions to construct data, time, and timestamp data, see Date & time functions. Default: 30 days from the current timestamp.
CREATED_TIME_END => constant_exprrequiredEnd time, in TIMESTAMP_LTZ format, for the time range to retrieve the job history. Default: Current timestamp.
RESULT_LIMIT => integerrequiredMaximum number of rows to return. If the number of matching rows exceeds the specified limit, only the jobs with the most recent timestamps are returned, up to the specified limit. Range: 1 to 10000 Default: 100

Output

The function returns the following columns: Column | Data Type | Description QUERY_ID | VARCHAR | ID of the EXECUTE JOB SERVICE SQL statement. ID | NUMBER | Internal/system-generated identifier for the job. NAME | VARCHAR | Name of the job. DATABASE_NAME | VARCHAR | Name of the database in which the job is created. SCHEMA_NAME | VARCHAR | Name of the schema in which the job is created. CREATED_TIME | TIMESTAMP_LTZ | Time when the job was created. COMPLETED_TIME | TIMESTAMP_LTZ | Time when the job was completed. DELETED_TIME | TIMESTAMP_LTZ | Time when the job was deleted. STATUS | VARCHAR | Staus of the job. MESSAGE | VARCHAR | Additional information about the job status. INSTANCE_STATUSES | OBJECT | Key-value pairs that describe job instances and containers. COMPUTE_POOL_NAME | VARCHAR | Name of the compute pool where the job was run. OWNER | VARCHAR | Role that owns the job. OWNER_ROLE_TYPE | VARCHAR | Type of role that owns the job, either ROLE or DATABASE_ROLE. PARAMETERS | OBJECT | Key-value pairs that describe the parameters that were specified when the job was created. MANAGING_OBJECT | OBJECT | Key-value pairs that describe the managing object. NULL if the job isn’t managed by Snowflake.

Access control requirements

The PUBLIC role has the privilege to use this function. Everyone can call this function, but the output depends on the current role. The output only includes the jobs that are owned by the current role.

See also