- Categories:
Table functions (Budgets)
MY_ BUDGET_ SUMMARY (SNOWFLAKE.LOCAL)¶
Returns the calling user’s limits, usage, and current block status for each per-user quota that applies to them in the current account.
Any user can call this function. It returns only the calling user’s information, so users can check
how much of their per-user limit they’ve used without asking an administrator and without privileges on the
quota or on the ACCOUNT_USAGE schema.
- See also:
Syntax¶
Arguments¶
None.
Returns¶
The function returns one row for each quota that applies to the calling user and each cycle that has a per-user limit. For example, a quota with daily, weekly, and monthly limits returns three rows. Cycles without a limit don’t return a row.
| Column | Data type | Description |
|---|---|---|
| ID | NUMBER | Identifier of the quota. |
| NAME | VARCHAR | Name of the quota. |
| DOMAINS | ARRAY | Array of the domains that the quota monitors, for example ["AI FUNCTION", "AI GATEWAY"]. See Usage notes. |
| CYCLE | VARCHAR | Cycle that the row describes: DAILY, WEEKLY, or MONTHLY. |
| START_TIME | TIMESTAMP_LTZ | Start of the current cycle. |
| END_TIME | TIMESTAMP_LTZ | End of the current cycle, when usage for the cycle resets. |
| PER_USER_LIMIT | FLOAT | Per-user limit for the cycle, in the unit shown in USAGE_UNIT. |
| USAGE | FLOAT | Calling user’s usage that counts toward the quota in the current cycle, in the unit shown in USAGE_UNIT. |
| USAGE_UNIT | VARCHAR | Unit for USAGE and PER_USER_LIMIT, for example CREDITS or AI_CREDITS. |
| PERCENT_CONSUMED | FLOAT | Percentage of the per-user limit consumed in the current cycle (USAGE / PER_USER_LIMIT * 100), rounded to two decimal places. |
| BLOCK_ENFORCEMENT_ENABLED | BOOLEAN | Whether the quota blocks users who reach the limit. If FALSE, usage still counts toward the limit, but the user isn’t blocked. |
| STATUS | VARCHAR | BLOCKED if the calling user is currently blocked by this quota for this cycle. Otherwise, NULL. |
If no quota applies to the calling user, the function returns no rows.
Access control requirements¶
No privileges are required. Any user can call this function, and it returns only the calling user’s information.
Usage notes¶
- Call the function in the
FROMclause with theTABLEkeyword:SELECT * FROM TABLE(SNOWFLAKE.LOCAL.MY_BUDGET_SUMMARY());. - Cycles start and end on UTC boundaries.
START_TIMEandEND_TIMEare displayed in the session’s time zone. DOMAINSlists only domains, even if the quota monitors selected resources within a domain.USAGEincludes only usage on the resources that the quota monitors.- Usage can count toward more than one quota. If quotas monitor overlapping domains, don’t add
USAGEacross those quotas to calculate total usage, because the overlapping usage would be double-counted. - Usage data is refreshed periodically, typically within minutes. Recent activity might not appear yet in
USAGEorPERCENT_CONSUMED. - Because
STATUSis updated with usage data, it can briefly lag behind enforcement. The calling user might already be blocked beforeSTATUSshowsBLOCKED. - The function returns information only for the current account.
Examples¶
Return the calling user’s limits and usage for each quota:
Return only the cycles in which the calling user has used more than 80% of the per-user limit: