altimate-code icon indicating copy to clipboard operation
altimate-code copied to clipboard

[bug] FinOps tools return zeroed/masked data despite valid ACCOUNT_USAGE access

Open arora-saurabh448 opened this issue 8 months ago • 2 comments

Problem

The FinOps tools (finops_analyze_credits, finops_warehouse_advice, finops_expensive_queries, finops_unused_resources) return masked/zeroed data (unknown warehouse names, 0.00 credits) even when the connected Snowflake role (ACCOUNTADMIN) has full access to SNOWFLAKE.ACCOUNT_USAGE views. The finops_warehouse_advice tool also fails with a SQL compilation error: invalid identifier 'WAREHOUSE_SIZE'.

Steps to Reproduce

  1. Configure a Snowflake warehouse connection (e.g., snowflake_sample) with a role that has ACCOUNT_USAGE access (tested with ACCOUNTADMIN).
  2. Verify direct SQL access works:
    SELECT COUNT(*) FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY 
    WHERE START_TIME >= DATEADD('day', -30, CURRENT_TIMESTAMP());
    
    → Returns 908 rows successfully.
  3. Verify the connection identity:
    SELECT CURRENT_ROLE(), CURRENT_USER(), CURRENT_ACCOUNT();
    
    → Returns ACCOUNTADMIN, SAURABH, BZB11272.
  4. Call finops_analyze_credits with warehouse: snowflake_sample, days: 30, limit: 50. → Returns all unknown warehouse names and 0.00 credits (13 rows of zeroed data).
  5. Call finops_warehouse_advice with warehouse: snowflake_sample, days: 30. → Fails with: 000904 (42000): SQL compilation error: error line 3 at position 4 invalid identifier 'WAREHOUSE_SIZE'.
  6. Call finops_expensive_queries and finops_unused_resources — both return zeroed/empty results.

Expected Behavior

FinOps tools should return actual credit consumption data matching the direct SQL query results (908 rows of valid metering history data across 13 active warehouses totaling ~230 credits over 30 days).

Actual Behavior

  • finops_analyze_credits: Returns masked data (all unknown / 0.00)
  • finops_warehouse_advice: SQL compilation error on WAREHOUSE_SIZE column
  • finops_expensive_queries: Returns zeroed results
  • finops_unused_resources: Returns zeroed results

Workaround

Query SNOWFLAKE.ACCOUNT_USAGE views directly via sql_execute to get the actual data.


Metadata

Field Value
CLI Version v0.4.0
Platform darwin
Architecture arm64
OS Release 24.6.0
Category bug
Working Directory ac-examples
Session ID ses_3070d9fdaffeV9OvBpIrq46996

arora-saurabh448 avatar Mar 16 '26 23:03 arora-saurabh448

Again stumbled across this issue in another session

Image

@suryaiyer95 @anandgupta42 @kulvirgit

arora-saurabh448 avatar Mar 17 '26 00:03 arora-saurabh448

Closing as fixed on main: Snowflake result columns are lowercased (drivers/src/snowflake.ts), and warehouse sizes come from SHOW WAREHOUSES instead of ACCOUNT_USAGE. Please reopen if you still see this on v0.12.9 or later.

anandgupta42 avatar Nov 05 '26 21:11 anandgupta42