Warehouse table
Register the Delta Lake table a Parquet bucket export keeps in BigQuery, Snowflake, Athena, Databricks, DuckDB or ClickHouse, check it against Costfluent, and run a report's SQL over it.
A Parquet bucket export can keep a Delta Lake table over the files it
delivers, so your warehouse reads a workspace's cost as one table, focus_costs, that always holds
the newest version of every day. Costfluent writes the statement that registers it in your
warehouse, filled with the destination's own bucket, prefix and workspace, and the SQL behind a
saved report or a dashboard's report widget runs against it with nothing to edit.
Before you start
- A bucket export destination with Parquet under File format. Adding or editing one needs the rights Bucket export names.
- Access in your warehouse to create a table, and to give it read access to the bucket, as the engine's section below names.
How it works
Costfluent copies no data for the table. After each run that delivers, it writes one commit into a
_delta_log/ folder under the workspace's feed folder, which removes the parts of each day's
previous version and adds the new version's parts, with the same write-only credential that writes
the files. Your warehouse registers the table once and reads the newest commit on every query, with
read access of its own, which the export never has.
Turn the table on
- Open Settings, then Workspaces, select the workspace, and find the Bucket export card.
- Select Add destination, or edit an existing destination.
- Choose Parquet under File format, and turn on Warehouse table. For CSV the switch is disabled, with "Parquet only."
- Save. The destination's row shows the table's path, with Copy table path and Connect a warehouse. It says "Warehouse table: waiting for the export run at" the time of the next run, in the workspace's time zone, until the first commit lands, and then names the commit.

The export runs every 4 hours from midnight UTC, at 15 minutes past. Each run delivers at most 31 days to a destination, so a new destination fills its history over several runs; the table holds a day once the run that delivers it has committed.
Connect a warehouse
- On the destination's row, select Connect a warehouse.
- Choose the Warehouse. An engine that cannot read the destination's storage is shown unavailable, with the reason.
- Give the engine read access as the line under the statement says, and as its section below describes.
- Select Copy statement and run the statement in your warehouse. Replace each value in angle brackets, such as a BigQuery project and dataset, with your own.

The statements below are the dialog's for each storage, with the destination's values as
placeholders. The table's root is the workspace's feed folder,
<prefix>/costfluent/<workspace ID>/focus-1.4/.
BigQuery
BigQuery reads a Google Cloud Storage destination as a BigLake table. It needs a Cloud resource connection whose service account has Storage Object Viewer on the bucket. BigQuery follows Create BigLake external tables for Delta Lake.
Code
Snowflake
Snowflake reads an AWS S3, Google Cloud Storage or Azure Blob Storage destination through an external volume over the bucket and a catalog integration for Delta Lake files, and refreshes the table on its own. The volume is read only. On AWS, name a role Snowflake assumes that may read the prefix; on Azure, your tenant. Snowflake follows CREATE ICEBERG TABLE (Delta files in object storage).
AWS S3:
Code
Google Cloud Storage:
Code
Azure Blob Storage:
Code
Athena
Athena reads an AWS S3 destination. It needs an AWS Glue database to create the table in, and
s3:GetObject and s3:ListBucket on the prefix for whoever queries it. Athena follows
Query Linux Foundation Delta Lake tables.
Code
Databricks
Databricks reads an AWS S3, Google Cloud Storage or Azure Blob Storage destination as a Unity Catalog external table. It needs a storage credential that can read the bucket and an external location over the table's path. Databricks follows Work with external tables.
AWS S3:
Code
Google Cloud Storage:
Code
Azure Blob Storage:
Code
DuckDB
DuckDB reads every storage with its delta extension. It needs a secret with read access to the
bucket; the statement creates one and a view focus_costs over delta_scan. Over Cloud Storage the
secret takes an HMAC key, and over Azure it signs in through the Azure credential chain. DuckDB
follows Delta Extension.
AWS S3:
Code
Google Cloud Storage:
Code
Azure Blob Storage:
Code
S3-compatible Object Storage:
Code
ClickHouse
ClickHouse reads an AWS S3, Azure Blob Storage or S3-compatible destination with its deltaLake
and deltaLakeAzure table functions; the statement creates a view focus_costs over one. It needs
credentials with read access to the bucket, in the statement or in a named collection. ClickHouse
follows deltaLake.
AWS S3:
Code
Azure Blob Storage:
Code
S3-compatible Object Storage:
Code
Check the result
Count the rows and sum BilledCost per day and BillingCurrency:
Code
- The newest day is the one the destination's row says it is delivered through, and a day without cost has no row.
- A month's days add up to the same month in a cost report with Amortized cost off and no filter, when the workspace is billed in one currency and the report does not convert it.
Virtual tags
The table's last column, x_VirtualTags, holds each row's virtual tags
as a JSON object of text, such as {"environment":"production","team":"payments"}:
- It carries every enabled virtual tag of the workspace, keyed by the tag's key, with the value a report gives the row. A draft is not exported until you publish it.
- Every exported key is on every row. Where no provider tag key, rule or default value gives the row a value, the value is empty text, the row a report shows as "No" and the tag's key.
- A workspace without an enabled virtual tag writes
{}. - An older virtual tag whose rule still reads another virtual tag is left out while that tag is deleted or disabled, since reports cannot read it then either.
Saving a virtual tag, publishing its draft, enabling a template or deleting a tag changes what the
column holds, so the export delivers every day of the history again over the next runs. Saving a
draft changes nothing. Each run still delivers the days whose cost changed first, oldest first, and
then refreshes the other days, newest first, within the days a run delivers, so new cost keeps
arriving while the history refreshes. A refresh alone never holds back the day the destination's row
says "Delivered through", nor makes it behind. While days are left to refresh, the row's
Delivery column also says "Updating virtual tags: 12 days left", counting the days the last run
left; the line goes once a run leaves none. Until a day is refreshed, the table holds its values
under the definitions it was last delivered with, so a query over it can differ from a report. Days
delivered before the files carried x_VirtualTags are delivered once more the same way; until
then, their parts lack the column and an engine reads it as null on their rows.
Each refreshed day is a new version= folder written in full, and the folder it replaces stays in
the bucket, since the export's credential only creates objects: every change to the virtual tags
adds another copy of the history to the bucket. A day's folder is replaced once a newer version=
folder of the same day holds a manifest.json; only those older folders are safe to delete (see
Versions). A lifecycle rule that deletes by age is not safe,
since an old day's only version is old too and the table still names it.
Read one tag, here team, in the engine that holds the table; replace team with your tag's key.
BigQuery:
Code
Snowflake:
Code
Athena:
Code
Databricks:
Code
DuckDB:
Code
ClickHouse:
Code
In BigQuery, qualify focus_costs with your dataset. Keys are case-sensitive, so team and Team
can be two virtual tags; Databricks matches the case only in the bracket form $["team"], not in
$.team, as get_json_object
says.
Copy SQL
Copy SQL under Export on a saved report writes the report's query over the table, for
BigQuery, Snowflake, Athena, DuckDB or ClickHouse; see Copy SQL.
A report widget on a dashboard has Copy SQL too, which writes its query as the dashboard shows
it; see Copy a widget's SQL.
The query reads focus_costs, the name every statement above gives the table, so it runs unchanged
against a table registered from Connect a warehouse; in BigQuery, qualify it with your dataset.
Copy SQL writes no Databricks query: Databricks reads the same table, so write your own over its
columns. A report grouped or filtered by a virtual tag reads the tag's key from x_VirtualTags,
with each day's values as of that day's last delivery (see Virtual tags). A report
using a segment gets no SQL: segments are Costfluent's own allocation, which the table does not
carry.
Troubleshooting
- The table reads empty or is not found. Until the first run commits, there is no
_delta_log/folder yet; the destination's row says "Warehouse table: waiting for the export run at" a time until then. - Access denied. The error comes from your warehouse's own read access to the bucket, not from the export, whose credential only writes. Check the access the engine's section names.
- Days are missing at the start. Days older than the first day the plan's history keeps are not delivered again when the table is turned on, so the table starts there; their files stay in their folders.
- A query fails on a missing file. A lifecycle rule or a person deleted a version folder or
_delta_log/that the table still names; see the caution under How it behaves. Keep lifecycle rules that delete objects off the workspace's feed folder. - BigQuery refuses the connection. BigQuery reads through a connection in the location of the bucket and the dataset; create the connection in that region.
- Snowflake shows an older day. Snowflake polls the bucket for new commits on its own, by
default every 30 seconds;
ALTER ICEBERG TABLE focus_costs REFRESHreads the newest commit at once.
How it behaves
- When a destination's runs have not written for a day, the organization roles Owner and Integration Owner are emailed the reason, once for each such streak; a run that writes, a move or a new credential ends the streak. An Azure destination's SAS is announced to them once, 14 days before it expires.
- A day delivered before the destination could keep a table is delivered once more, under a newer version, when the table is turned on, so the table can name its files. Days older than the first day the plan's history keeps are not delivered again and stay in their folders only.
- Turned off, the table stops moving: Costfluent writes no more commits, and an engine reads the table as of its last one. Turned on again, the next run starts a new log above the old one. The log folder is never deleted, like the version folders.
- One folder holds one table: while a destination of the workspace keeps a table, another destination of it writing to the same bucket and prefix cannot turn its own on.
- The table holds the columns of the files, typed as the Parquet parts are.
The table names the parts of each day's newest version. Delete only version folders a newer version
of their day replaced, and never _delta_log/, or the engines fail to read the files the table still
names.
From your assistant
With the Costfluent MCP server connected, your assistant answers these with get_cost_report_sql.
Code
Code