SERVERLESS_TASK_HISTORY

functionsupportedUDFs, procedures, tasks, alerts, scripting

docs.snowflake.com ↗

Information SchemaTable functions

This table function is used for querying the serverless task usage history. The information returned by the function includes the task name and credits consumed by runs of each task. Note This function is generally deprecated in favor of the ACCOUNT_USAGE.SERVERLESS_TASK_HISTORY view, which provides a more complete data set and supports longer date ranges. Unlike this function, which returns only the task name, the view also returns a TASK_ID column that identifies each task.

Syntax

supportedpartialnot supportednot scored

SERVERLESS_TASK_HISTORY(
      [ DATE_RANGE_START => <constant_expr> ]
      [ , DATE_RANGE_END => <constant_expr> ]
      [ , TASK_NAME => '<string>' ] )

Parameters

NameRequiredDescription
DATE_RANGE_START => constant_expr , DATE_RANGE_END => constant_exprrequiredDate/time range of the usage window: If an end date is not specified, then CURRENT_DATE is used as the end of the range. If a start date is not specified, then the range starts 10 minutes prior to the start of DATE_RANGE_END (i.e. the default is to show the previous 10 minutes of the usage history). For example, if DATE_RANGE_END is CURRENT_DATE, then the default DATE_RANGE_START is 11:50 PM on the previous day.
TASK_NAME => stringrequiredThe name of the task to retrieve usage history for. Only the usage data for the specified task is returned. Note that the task name must be enclosed in single quotes. Also, if the task name contains any spaces, mixed-case characters, or special characters, the name must be double-quoted within the single quotes (e.g. '"My Task"' vs 'mytask').

Usage notes

Output

The function returns the following columns: Column Name | Data Type | Description START_TIME | TIMESTAMP_LTZ | Start of the specified time range. END_TIME | TIMESTAMP_LTZ | End of the specified time range. TASK_NAME | TEXT | Name of the task. CREDITS_USED | TEXT | Number of credits billed for serverless task usage during the START_TIME and END_TIME window.