Skip to main content

Save your warehouse metering into Snowflake

Yuki publishes your warehouse-metering data to your own Snowflake account as a private listing. You query it directly in Snowflake.

Run the steps below in a Snowflake worksheet (Snowsight) or via SnowSQL/snow.

Prerequisites
  • A role with CREATE DATABASE and IMPORT SHARE (e.g. ACCOUNTADMIN)
  • A running warehouse
  • The listing name Yuki gave you (referred to below as <LISTING_NAME>)

1. Create a database from the listing

USE ROLE ACCOUNTADMIN;
USE WAREHOUSE <YOUR_WAREHOUSE>;

CREATE DATABASE yuki_metering FROM LISTING '<LISTING_NAME>';

You can name the database anything; yuki_metering is just a suggestion.

2. Query your data

SELECT *
FROM yuki_metering.share.fact_warehouse_metering_share
LIMIT 100;

Columns:

ColumnMeaning
warehouse_nameWarehouse name
start_dateDay (date) of the metering record
is_yuki_whWhether it ran on a Yuki-managed warehouse
credits_used_computeCompute credits that day
credits_cloud_servicesCloud-services credits that day
credits_attributed_compute_queriesCompute credits attributed to queries

One row per warehouse per day. Example, daily credits for the last 30 days:

SELECT start_date, SUM(credits_used_compute) AS credits_used_compute
FROM yuki_metering.share.fact_warehouse_metering_share
WHERE start_date >= DATEADD(day, -30, CURRENT_DATE)
GROUP BY start_date
ORDER BY start_date;
tip

The data refreshes automatically, you don't need to re-import, just re-query.

Troubleshooting

SymptomWhat to do
... is not fulfilled to your current region on CREATE DATABASEContact Yuki; we will enable your region and tell you when to re-run step 1.
CREATE DATABASE fails on privilegesUse ACCOUNTADMIN, or grant your role CREATE DATABASE + IMPORT SHARE.
No active warehouse selected in the current sessionRun USE WAREHOUSE <YOUR_WAREHOUSE>; first.
Query returns 0 rowsYour account isn't enabled yet, or you're querying from a different account than the one registered. Contact Yuki.
You don't have the listing nameAsk Yuki for your <LISTING_NAME>.