# Snowflake Warehouse Idle Credit Audit from Metering CSV (`natstandridge/snowflake-warehouse-idle-credit-audit`) Actor

Paste bounded Snowflake ACCOUNT_USAGE warehouse metering rows to review compute credits not attributed to queries. Get exact warehouse-level evidence for the supplied hours, with data-lag and coverage limits stated.

- **URL**: https://apify.com/natstandridge/snowflake-warehouse-idle-credit-audit.md
- **Developed by:** [Nathaniel Standridge](https://apify.com/natstandridge) (community)
- **Categories:** Business, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$50.00 / 1,000 delivered warehouse idle-compute reviews

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Snowflake Warehouse Idle Credit Audit

Review compute credits in a Snowflake warehouse metering export that Snowflake did not attribute to query execution. Paste a small hourly CSV, then get one importable action row per warehouse with positive observed idle compute credits. The Actor reads only your pasted data. It does not connect to Snowflake, change a warehouse, estimate a bill, or claim realized savings.

**For:** FinOps and data platform teams reviewing warehouse suspend, resume, and sizing settings each week. The next action is a human review of the affected warehouse's workload and configuration.

### First run

1. Open the Actor's Input form and choose **Restore example input**, then **Start**. Every field is prefilled with the synthetic sample shown below. Its six hourly rows for three fake warehouses return two findings, costing **$0.10 total** at the current $0.05-per-finding price. No Snowflake login is needed. The sample is stored in the Actor input like any other run.
2. In Snowflake, export the same five columns from [`SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/warehouse_metering_history). Use UTC timestamps with seconds and `Z`. An example query for a *completed* period is below. Adjust the period and run it at least six hours after the end time.
3. Replace the sample CSV in `meteringCsv` and all three sample timestamps: `periodStart`, `periodEnd` (exclusive), and the time you actually exported it in `exportedAt`. The Actor checks that the declared export time is at least six hours after the period end. The declaration is not verified against Snowflake.
4. Review the paid dataset rows and the free `OUTPUT` summary. Filter by `observedIdleComputeCredits`; join the warehouse name to your own operational review. A header-only or zero-idle input produces no paid findings.

#### Runnable sample input

This is the same synthetic input used by **Restore example input** and the Actor's automated checks. API callers must send the required fields explicitly; missing data is rejected, never replaced with sample data.

```json
{
  "periodStart": "2026-11-01T00:00:00Z",
  "periodEnd": "2026-11-01T03:00:00Z",
  "exportedAt": "2026-11-02T12:00:00Z",
  "meteringCsv": "START_TIME,END_TIME,WAREHOUSE_NAME,CREDITS_USED_COMPUTE,CREDITS_ATTRIBUTED_COMPUTE_QUERIES\n2026-11-01T00:00:00Z,2026-11-01T01:00:00Z,WH_A,2.00,0.75\n2026-11-01T01:00:00Z,2026-11-01T02:00:00Z,WH_A,1.50,1.00\n2026-11-01T02:00:00Z,2026-11-01T03:00:00Z,WH_A,0.50,0.50\n2026-11-01T00:00:00Z,2026-11-01T01:00:00Z,WH_B,1.00,0.80\n2026-11-01T01:00:00Z,2026-11-01T02:00:00Z,WH_B,0.75,0.75\n2026-11-01T00:00:00Z,2026-11-01T01:00:00Z,WH_C,1.00,1.00\n",
  "minIdleCredits": "0.01",
  "maxFindings": 25,
  "maxRunSeconds": 120
}
```

The dataset contains these two findings, plus the period, export time, observation ID, scope, and review guidance described below:

| Warehouse | Observed hours | Compute credits | Query-attributed credits | Idle compute credits | Idle share |
| --- | ---: | ---: | ---: | ---: | ---: |
| WH_A | 3 | 4.00 | 2.25 | 1.75 | 43.75% |
| WH_B | 2 | 1.75 | 1.55 | 0.20 | 11.43% |

WH_C has zero idle compute and produces no paid finding. The free summary reports six source rows, three warehouses, `observedIdleComputeCredits="1.95"`, `findingsDelivered=2`, and `complete=true`.

#### Export your own metering data

```sql
SELECT
  TO_VARCHAR(CONVERT_TIMEZONE('UTC', START_TIME), 'YYYY-MM-DD"T"HH24:MI:SS"Z"') AS START_TIME,
  TO_VARCHAR(CONVERT_TIMEZONE('UTC', END_TIME), 'YYYY-MM-DD"T"HH24:MI:SS"Z"') AS END_TIME,
  WAREHOUSE_NAME,
  CREDITS_USED_COMPUTE,
  CREDITS_ATTRIBUTED_COMPUTE_QUERIES
FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY
WHERE START_TIME >= TO_TIMESTAMP_TZ('2026-11-01T00:00:00Z')
  AND END_TIME <= TO_TIMESTAMP_TZ('2026-11-08T00:00:00Z')
ORDER BY WAREHOUSE_NAME, START_TIME;
```

This SQL is a documented-shape example, not a live Snowflake query tested against your account. Snowflake's [attribution guide](https://docs.snowflake.com/en/user-guide/cost-attributing) explains that `CREDITS_ATTRIBUTED_COMPUTE_QUERIES` excludes idle warehouse time, and its [release note](https://docs.snowflake.com/en/release-notes/bcr-bundles/2024_08/bcr-1714) describes up to six hours of latency for the column. Check Snowflake's current definitions for your warehouse type and billing model before relying on a report.

### Input contract

The CSV header must contain exactly `START_TIME,END_TIME,WAREHOUSE_NAME,CREDITS_USED_COMPUTE,CREDITS_ATTRIBUTED_COMPUTE_QUERIES`, in any order. Timestamp cells must be UTC ISO 8601 seconds ending in `Z`, such as `2026-11-01T00:00:00Z`; every row must describe one complete hour inside `[periodStart, periodEnd)`. A warehouse may appear once per hour. Warehouse names support Snowflake's 255-character identifier limit. For safe spreadsheet exports, names must contain printable characters, have no leading/trailing whitespace, and not start with `=`, `+`, `-`, or `@`; rename such identifiers consistently in your export before use. Credits must be nonnegative decimal strings, with at most 12 integral and 12 fractional digits. A null or blank attributed-credit cell is rejected, so missing attribution cannot be mistaken for idle compute. **Adaptive Warehouses are unsupported:** Snowflake reports NULL query-attributed compute credits for them. Values where attributed query credits exceed compute credits are rejected as inconsistent. Duplicate warehouse/hour rows are rejected rather than double-counted.

Input is limited to 256,000 UTF-8 bytes, 3,000 data rows, a 31-day period, and 50 paid findings. `maxFindings` defaults to 25 and is an all-or-nothing cap: if more warehouses qualify, the run rejects before dataset writes. `minIdleCredits` defaults to `0.01`; a warehouse must have a *positive* observed difference at or above it. `maxRunSeconds` defaults to 120. Unknown input keys, including credentials, are rejected. Do not paste a Snowflake token, query text, customer data, or extra columns. Warehouse names appear in the output; use names you are authorized to process and set your Apify data retention accordingly.

### How to read a finding

For each supplied warehouse/hour, `observedIdleComputeCredits = CREDITS_USED_COMPUTE - CREDITS_ATTRIBUTED_COMPUTE_QUERIES`. The paid row sums that difference across the supplied hours. It also reports the metered and query-attributed denominators, observed hour count, number of positive-idle hours, largest hourly difference, first/last observed hour, declared export time, and a stable `observationId` for this exact input. Credits are not USD. The Actor does not know the buyer's contracted credit price, adjustments, cloud-services billing, missing rows, or whether suspend/resize is safe. A partial CSV yields a partial observation; absence of a row does not mean zero usage. The `sourceScope` and `interpretation` fields state these limits in every paid row.

The free `OUTPUT` summary includes source row and warehouse counts, totals from all supplied valid rows, number below the threshold, planned/delivered findings, and completion status. Invalid input writes only an `invalid_input` summary with a safe error code. Empty or zero-idle input has `status=empty` and no paid dataset rows.

### Pricing and reliability

The price is **$0.05 per delivered warehouse finding** ($50 per 1,000 findings), including run compute. The two-finding sample costs **$0.10**. There is no start charge. Invalid input, empty results, rows below the threshold, and a preflight charge-cap shortfall produce no finding charges. See the Store Pricing tab for the current price; Apify's standard post-run storage charges may still apply.

The Actor freezes its complete result plan before paid delivery. In cloud runs it writes directly to the default dataset with SDK automatic retries disabled, checkpoints pending row IDs, and reconciles dataset rows against the frozen plan and native event count on restart. A write with an unknown outcome stops without replaying it; a restart can clear the checkpoint only after the expected records are visible. A customer charge cap below the price of every planned finding produces an incomplete free summary and zero paid rows. If an export changes, start a new run; the original run's frozen plan is bound to its exact input fingerprint.

### Local verification

From this directory:

```bash
uv run --frozen pytest -q
uv run --frozen python -B tools/local_smoke.py examples/local-validation.json
```

The local `examples/` directory contains synthetic fixtures and the bounded cloud validation plan. Checks cover exact arithmetic, the schema-prefilled first run, malformed and empty input, identifier boundaries, charge caps, uncertain delivery, and same-run recovery. Cloud validation separately checks the delivered dataset and native charge counts.

### Version 0.2

Added complete synthetic prefills for the Store Input form and automated checks, embedded runnable examples in this README, clarified pricing and unsupported inputs, and expanded warehouse names to Snowflake's 255-character limit. The output fields, credit calculations, and per-finding price are unchanged.

# Actor input Schema

## `meteringCsv` (type: `string`):

The prefilled synthetic sample returns two findings ($0.10 total). Replace it with the exact five-column CSV exported from SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY: START_TIME, END_TIME, WAREHOUSE_NAME, CREDITS_USED_COMPUTE, CREDITS_ATTRIBUTED_COMPUTE_QUERIES. Also replace all three sample timestamps. Timestamp cells must be UTC ISO seconds with Z. Header-only CSV is a free empty result. Up to 3,000 rows and 256,000 UTF-8 bytes. Do not paste credentials or extra columns. Adaptive Warehouses with NULL query-attributed credits are unsupported.

## `periodStart` (type: `string`):

Whole-hour UTC timestamp, inclusive. Period may span at most 31 days. Findings cover supplied rows only.

## `periodEnd` (type: `string`):

Whole-hour UTC timestamp, exclusive. Every supplied hourly row must fit within the period.

## `exportedAt` (type: `string`):

User-declared export time. It must be at least six hours after periodEnd because Snowflake's attributed-compute column can lag. This declaration is not verified against Snowflake.

## `minIdleCredits` (type: `string`):

Only positive warehouses at or above this threshold produce a paid finding. Zero/empty results and invalid input are free.

## `maxFindings` (type: `integer`):

Hard cap: if more warehouses qualify, the whole input is rejected before paid delivery. Narrow the export or raise the cap.

## `maxRunSeconds` (type: `integer`):

Bounds parsing, checkpointing, and paid dataset delivery.

## Actor input object example

```json
{
  "meteringCsv": "START_TIME,END_TIME,WAREHOUSE_NAME,CREDITS_USED_COMPUTE,CREDITS_ATTRIBUTED_COMPUTE_QUERIES\n2026-11-01T00:00:00Z,2026-11-01T01:00:00Z,WH_A,2.00,0.75\n2026-11-01T01:00:00Z,2026-11-01T02:00:00Z,WH_A,1.50,1.00\n2026-11-01T02:00:00Z,2026-11-01T03:00:00Z,WH_A,0.50,0.50\n2026-11-01T00:00:00Z,2026-11-01T01:00:00Z,WH_B,1.00,0.80\n2026-11-01T01:00:00Z,2026-11-01T02:00:00Z,WH_B,0.75,0.75\n2026-11-01T00:00:00Z,2026-11-01T01:00:00Z,WH_C,1.00,1.00\n",
  "periodStart": "2026-11-01T00:00:00Z",
  "periodEnd": "2026-11-01T03:00:00Z",
  "exportedAt": "2026-11-02T12:00:00Z",
  "minIdleCredits": "0.01",
  "maxFindings": 25,
  "maxRunSeconds": 120
}
```

# Actor output Schema

## `findings` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "meteringCsv": `START_TIME,END_TIME,WAREHOUSE_NAME,CREDITS_USED_COMPUTE,CREDITS_ATTRIBUTED_COMPUTE_QUERIES
2026-11-01T00:00:00Z,2026-11-01T01:00:00Z,WH_A,2.00,0.75
2026-11-01T01:00:00Z,2026-11-01T02:00:00Z,WH_A,1.50,1.00
2026-11-01T02:00:00Z,2026-11-01T03:00:00Z,WH_A,0.50,0.50
2026-11-01T00:00:00Z,2026-11-01T01:00:00Z,WH_B,1.00,0.80
2026-11-01T01:00:00Z,2026-11-01T02:00:00Z,WH_B,0.75,0.75
2026-11-01T00:00:00Z,2026-11-01T01:00:00Z,WH_C,1.00,1.00`,
    "periodStart": "2026-11-01T00:00:00Z",
    "periodEnd": "2026-11-01T03:00:00Z",
    "exportedAt": "2026-11-02T12:00:00Z",
    "minIdleCredits": "0.01",
    "maxFindings": 25,
    "maxRunSeconds": 120
};

// Run the Actor and wait for it to finish
const run = await client.actor("natstandridge/snowflake-warehouse-idle-credit-audit").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "meteringCsv": """START_TIME,END_TIME,WAREHOUSE_NAME,CREDITS_USED_COMPUTE,CREDITS_ATTRIBUTED_COMPUTE_QUERIES
2026-11-01T00:00:00Z,2026-11-01T01:00:00Z,WH_A,2.00,0.75
2026-11-01T01:00:00Z,2026-11-01T02:00:00Z,WH_A,1.50,1.00
2026-11-01T02:00:00Z,2026-11-01T03:00:00Z,WH_A,0.50,0.50
2026-11-01T00:00:00Z,2026-11-01T01:00:00Z,WH_B,1.00,0.80
2026-11-01T01:00:00Z,2026-11-01T02:00:00Z,WH_B,0.75,0.75
2026-11-01T00:00:00Z,2026-11-01T01:00:00Z,WH_C,1.00,1.00
""",
    "periodStart": "2026-11-01T00:00:00Z",
    "periodEnd": "2026-11-01T03:00:00Z",
    "exportedAt": "2026-11-02T12:00:00Z",
    "minIdleCredits": "0.01",
    "maxFindings": 25,
    "maxRunSeconds": 120,
}

# Run the Actor and wait for it to finish
run = client.actor("natstandridge/snowflake-warehouse-idle-credit-audit").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "meteringCsv": "START_TIME,END_TIME,WAREHOUSE_NAME,CREDITS_USED_COMPUTE,CREDITS_ATTRIBUTED_COMPUTE_QUERIES\\n2026-11-01T00:00:00Z,2026-11-01T01:00:00Z,WH_A,2.00,0.75\\n2026-11-01T01:00:00Z,2026-11-01T02:00:00Z,WH_A,1.50,1.00\\n2026-11-01T02:00:00Z,2026-11-01T03:00:00Z,WH_A,0.50,0.50\\n2026-11-01T00:00:00Z,2026-11-01T01:00:00Z,WH_B,1.00,0.80\\n2026-11-01T01:00:00Z,2026-11-01T02:00:00Z,WH_B,0.75,0.75\\n2026-11-01T00:00:00Z,2026-11-01T01:00:00Z,WH_C,1.00,1.00\\n",
  "periodStart": "2026-11-01T00:00:00Z",
  "periodEnd": "2026-11-01T03:00:00Z",
  "exportedAt": "2026-11-02T12:00:00Z",
  "minIdleCredits": "0.01",
  "maxFindings": 25,
  "maxRunSeconds": 120
}' |
apify call natstandridge/snowflake-warehouse-idle-credit-audit --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,natstandridge/snowflake-warehouse-idle-credit-audit"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/aylBXNrtNbTNTeeqJ/builds/WwRKSrPprup20x4mx/openapi.json
