Skip to content

FOCUS cloud costs

Normalizes AWS, Azure and Google Cloud billing exports into the FinOps FOCUS schema

Connector software
Free and open source
Service credentials
Not needed
Use with an agent

Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.

npx skills add Query-farm/vgi-skills --skill orchard

Copy this request into your coding agent to get started.

Use https://query.farm/products/orchard/connectors/focus-cost/index.md to help me query FOCUS cloud costs with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.

Compare cloud spending across AWS, Azure and Google Cloud

Uses the connector’s bundled sample billing exports from AWS, Azure and Google Cloud.

Example output · captured
Connector release
v0.2.0
Engine
2.0.1
VGI protocol
3.4.0
SELECT ProviderName, ServiceCategory, sum(EffectiveCost) AS effective_cost
FROM (SELECT * FROM focus.main.focus('sample://aws_cur2') UNION ALL SELECT * FROM focus.main.focus('sample://azure/contoso-actual-cost-202607.csv') UNION ALL SELECT * FROM focus.main.focus('sample://gcp/gcp_billing_export_v1_01A2B3_202607.parquet'))
GROUP BY ALL
ORDER BY effective_cost DESC
Result · first 5 rows
ProviderName ServiceCategory effective_cost
AWS Compute 377.54
Google Cloud Other 318.75
AWS Other 300
AWS Databases 262.25
Google Cloud Compute 220.86

Quick start

Choose where to run FOCUS cloud costs, then follow the steps below.

The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.

1. Install the vgi extension

Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.

setup.sql
SET allow_extension_repositories = 'allowed';

CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
    WITH PREFIX 'https://duckdb-extensions.query.farm';

INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;

2. Attach the connector

Attach with uvx

Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.

ATTACH 'focus' AS focus (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-focus-worker'
);

3. Run a query

query.sql
SELECT ProviderName, ServiceCategory, sum(EffectiveCost) AS effective_cost
FROM (SELECT * FROM focus.main.focus('sample://aws_cur2') UNION ALL SELECT * FROM focus.main.focus('sample://azure/contoso-actual-cost-202607.csv') UNION ALL SELECT * FROM focus.main.focus('sample://gcp/gcp_billing_export_v1_01A2B3_202607.parquet'))
GROUP BY ALL
ORDER BY effective_cost DESC
More example queries →
Technical details
Verified connector release
v0.2.0
Engine
2.0.1
VGI protocol
3.4.0
Verified on
December 1, 2026
Release notes on GitHub
Pin a version for production

When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.

Attach with uvx

Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.

ATTACH 'focus' AS focus (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-focus-worker'
);

Overview

Normalize AWS, Azure and Google Cloud billing exports into the FinOps FOCUS 1.x schema, so one DuckDB query covers every cloud, with exact decimal money and conformance checks.

Catalog

Everything focus exposes once attached — read straight from the worker's released build.

focus 1 schema
main 4 tables · 10 functions

FOCUS readers, mapping, validation, reference tables and exact-arithmetic scalars.

Schema examples (13)
Examples (13)

Amortized spend by cloud and service category across AWS, Azure and GCP exports

SELECT ProviderName, ServiceCategory, sum(EffectiveCost) AS effective_cost
FROM (SELECT * FROM focus.main.focus('sample://aws_cur2') UNION ALL SELECT * FROM focus.main.focus('sample://azure/contoso-actual-cost-202607.csv') UNION ALL SELECT * FROM focus.main.focus('sample://gcp/gcp_billing_export_v1_01A2B3_202607.parquet'))
GROUP BY ALL
ORDER BY effective_cost DESC;
Result · first 5 rows
ProviderName ServiceCategory effective_cost
AWS Compute 377.54
Google Cloud Other 318.75
AWS Other 300
AWS Databases 262.25
Google Cloud Compute 220.86

July invoice cost by team tag in the AWS CUR 2.0 sample

SELECT Tags['team'] AS team, sum(BilledCost) AS billed
FROM focus.main.focus('sample://aws_cur2', billing_period := '2026-07')
WHERE Tags['team'] IS NOT NULL
GROUP BY team
ORDER BY billed DESC;

Map raw CUR 2.0 rows written inline to FOCUS

SELECT ChargeCategory, CommitmentDiscountStatus, BilledCost, EffectiveCost
FROM focus.main.to_focus((SELECT * FROM (VALUES ('Usage', 1.9584, NULL, NULL), ('SavingsPlanCoveredUsage', 3.9168, 2.7408, 'arn:aws:savingsplans::1:savingsplan/x')) AS t(line_item_line_item_type, line_item_unblended_cost, savings_plan_savings_plan_effective_cost, savings_plan_savings_plan_a_r_n)))
ORDER BY BilledCost;

Checks a native FOCUS 1.2 export does not pass as FOCUS 1.3

SELECT check_name, column_name, status
FROM focus.main.focus_validate('sample://focus12', spec_version := '1.3')
WHERE status <> 'pass'
ORDER BY check_name, column_name;
9 more examples

Error-level checks of the mapped GCP billing export sample

SELECT check_name, column_name, failing_rows, sample_value
FROM focus.main.focus_validate('sample://gcp/gcp_billing_export_v1_01A2B3_202607.parquet')
WHERE severity = 'error'
ORDER BY failing_rows DESC, check_name;

Classify EC2

SELECT focus.main.focus_service_category('aws', 'AmazonEC2') AS category;

Classify Cosmos DB

SELECT focus.main.focus_service_subcategory('azure', 'Azure Cosmos DB') AS subcategory;

AWS reserved-instance fee

SELECT focus.main.focus_charge_category('aws', 'RIFee') AS category;

Where GCP list cost goes

SELECT focus.main.focus_map_column('gcp', 'cost_at_list') AS focus_columns;

An invalid ChargeFrequency

SELECT focus.main.focus_validate_value('ChargeFrequency', 'Monthly') AS problem;

A lower-case ChargeCategory is rejected by FOCUS 1.0

SELECT focus.main.focus_validate_value('ChargeCategory', 'usage', '1.0') AS problem;

Effective-to-list cost ratio of the AWS sample without DOUBLE rounding

SELECT focus.main.focus_divide(sum(EffectiveCost), sum(ListCost)) AS effective_over_list
FROM focus.main.focus('sample://aws_cur2');

Effective rate per resource in the AWS sample

SELECT ResourceId,
  focus.main.focus_effective_rate(sum(EffectiveCost), sum(PricingQuantity)) AS rate
FROM focus.main.focus('sample://aws_cur2')
WHERE ChargeCategory = 'Usage' AND ResourceId IS NOT NULL
GROUP BY ResourceId
ORDER BY rate DESC;
Tables
charge_type_map 1 example4 cols

Provider charge types -> FOCUS ChargeCategory (and ChargeFrequency for AWS).

Columns
sourcenot null VARCHAR
Source token: aws_cur2, azure (both Azure tokens) or gcp.
charge_typenot null VARCHAR
The provider's raw charge type (line_item_line_item_type, ChargeType, cost_type).
charge_category VARCHAR
FOCUS ChargeCategory it maps to.
charge_frequency VARCHAR
FOCUS ChargeFrequency where the charge type decides it, else NULL.
ConstraintsPRIMARY KEY (source, charge_type)
Example

AWS line item types that are FOCUS purchases

SELECT charge_type, charge_frequency
FROM focus.main.charge_type_map
WHERE source = 'aws_cur2' AND charge_category = 'Purchase'
ORDER BY charge_type;
Link
focus_columns 2 examples12 cols

The FOCUS specification's Cost and Usage columns for versions 1.0 to 1.4 (CC BY 4.0, FinOps Foundation).

Columns
spec_versionnot null VARCHAR
FOCUS version, '1.0' to '1.4'.
column_namenot null VARCHAR
FOCUS Column ID, e.g. 'BilledCost'.
display_name VARCHAR
The spec's display name, e.g. 'Billed Cost'.
description VARCHAR
The spec's one-sentence description of the column.
column_type VARCHAR
'Dimension' or 'Metric'.
feature_level VARCHAR
'Mandatory', 'Conditional' or 'Recommended'.
allows_nulls BOOLEAN
Whether the spec allows NULL in this column.
data_type VARCHAR
The spec's data type: String, Decimal, Date/Time or JSON.
duckdb_type VARCHAR
The DuckDB type focus() and to_focus() emit for this column.
value_format VARCHAR
The spec's value format, e.g. 'Numeric Format', 'Allowed Values'.
allowed_values VARCHAR[]
The closed set of allowed values, or NULL when any value is allowed.
introduced VARCHAR
The FOCUS version that introduced the column.
ConstraintsPRIMARY KEY (spec_version, column_name)
Examples (2)

Allowed ChargeCategory values in FOCUS 1.2

SELECT unnest(allowed_values) AS v
FROM focus.main.focus_columns
WHERE spec_version = '1.2' AND column_name = 'ChargeCategory'
ORDER BY v;

Columns added in FOCUS 1.3

SELECT column_name
FROM focus.main.focus_columns
WHERE spec_version = '1.3' AND column_name NOT IN (SELECT column_name FROM focus.main.focus_columns WHERE spec_version = '1.2')
ORDER BY column_name;
Link
provider_map 2 examples7 cols

How every FOCUS column is derived from each provider's export: the auditable mapping rules.

Columns
sourcenot null VARCHAR
Source token for focus()/to_focus(): aws_cur2, azure, azure_amortized, gcp, focus.
provider VARCHAR
Cloud: aws, azure, gcp, or 'any' for native FOCUS files.
focus_columnnot null VARCHAR
The FOCUS (or x_ extension) column produced.
source_columns VARCHAR[]
Raw export columns read to produce it (empty for constants).
transform VARCHAR
How the value is derived, in words.
notes VARCHAR
Caveats and provider-specific detail; NULL when none.
filter_pushdown BOOLEAN
True when a comparison on this column is pushed into the Parquet scan.
ConstraintsPRIMARY KEY (source, focus_column)
Examples (2)

Where AWS EffectiveCost comes from

SELECT len(source_columns) AS inputs, filter_pushdown
FROM focus.main.provider_map
WHERE source = 'aws_cur2' AND focus_column = 'EffectiveCost';

Columns pushed into the Parquet scan per source

SELECT source, count(*) FILTER (WHERE filter_pushdown) AS pushed
FROM focus.main.provider_map
WHERE source <> 'focus'
GROUP BY source
ORDER BY source;
Link
service_map 1 example5 cols

Curated provider service -> FOCUS ServiceName, ServiceCategory and ServiceSubcategory.

Columns
providernot null VARCHAR
aws, azure or gcp.
service_codenot null VARCHAR
Provider service key: AWS product code, Azure MeterCategory, GCP service description.
service_name VARCHAR
The ServiceName emitted for it.
service_category VARCHAR
FOCUS ServiceCategory.
service_subcategory VARCHAR
FOCUS ServiceSubcategory (1.1+).
ConstraintsPRIMARY KEY (provider, service_code)
Example

Database services per provider

SELECT provider, count(*) AS services
FROM focus.main.service_map
WHERE service_category = 'Databases'
GROUP BY provider
ORDER BY provider;
Link
Scalar functions
focus_charge_category (provider VARCHAR, charge_type VARCHAR) 2 examples

FOCUS ChargeCategory for a raw provider charge type, e.g. ('aws', 'RIFee') -> 'Purchase'

Arguments
provider VARCHAR
Cloud provider; the spellings 'AWS', 'Microsoft' and 'Google Cloud' are accepted too. NULL in, NULL out.
charge_type VARCHAR
The provider's raw charge type as it appears in the export (see charge_type_map).
ReturnsVARCHAR
Examples (2)

AWS reserved-instance fee

SELECT focus.main.focus_charge_category('aws', 'RIFee') AS category;
SELECT focus.main.focus_charge_category(p, t) AS c
FROM (VALUES ('aws', 'SavingsPlanCoveredUsage', 1), ('azure', 'Purchase', 2), ('gcp', 'tax', 3)) v(p, t, i)
ORDER BY i;
Link
focus_divide (numerator DECIMAL(38,10), denominator DECIMAL(38,10)) 2 examples

Exact decimal division to DECIMAL(19,10), half-even; NULL on a zero or NULL denominator

Arguments
numerator DECIMAL(38,10)
Dividend, e.g. sum(EffectiveCost).
denominator DECIMAL(38,10)
Divisor; 0 or NULL gives NULL.
ReturnsDECIMAL(19,10)
Examples (2)

Effective-to-list cost ratio of the AWS sample without DOUBLE rounding

SELECT focus.main.focus_divide(sum(EffectiveCost), sum(ListCost)) AS effective_over_list
FROM focus.main.focus('sample://aws_cur2');
SELECT focus.main.focus_divide(10, 3) AS r,
  focus.main.focus_divide(1, 0) AS z;
Link
focus_effective_rate (cost DECIMAL(38,10), quantity DECIMAL(38,10)) 2 examples

Exact unit rate cost / quantity as DECIMAL(19,10); NULL when quantity is 0 or NULL

Arguments
cost DECIMAL(38,10)
Cost, e.g. EffectiveCost.
quantity DECIMAL(38,10)
Quantity, e.g. PricingQuantity; 0 gives NULL.
ReturnsDECIMAL(19,10)
Examples (2)

Effective rate per resource in the AWS sample

SELECT ResourceId,
  focus.main.focus_effective_rate(sum(EffectiveCost), sum(PricingQuantity)) AS rate
FROM focus.main.focus('sample://aws_cur2')
WHERE ChargeCategory = 'Usage' AND ResourceId IS NOT NULL
GROUP BY ResourceId
ORDER BY rate DESC;
SELECT focus.main.focus_effective_rate(2.7408, 24) AS rate;
Link
focus_map_column (source VARCHAR, source_column VARCHAR) 3 examples

Which FOCUS columns a raw export column feeds, e.g. ('aws_cur2', 'line_item_unblended_cost')

Arguments
source VARCHAR
Export format token, as for focus().
source_column VARCHAR
Raw export column name, case-insensitive.
ReturnsVARCHAR
Examples (3)

Where GCP list cost goes

SELECT focus.main.focus_map_column('gcp', 'cost_at_list') AS focus_columns;
SELECT focus.main.focus_map_column('aws_cur2', 'lineItem/UnblendedCost') AS cols;
SELECT focus.main.focus_map_column('azure', 'CostCenter') IS NULL AS unused;
Link
focus_service_category (provider VARCHAR, service VARCHAR) 2 examples

FOCUS ServiceCategory for a provider service, e.g. ('aws', 'AmazonEC2') -> 'Compute'

Arguments
provider VARCHAR
Cloud provider; the spellings 'AWS', 'Microsoft' and 'Google Cloud' are accepted too. NULL in, NULL out.
service VARCHAR
Provider service key: AWS product code ('AmazonEC2'), Azure MeterCategory ('Virtual Machines'), GCP service description ('Compute Engine'); display names also match. Case-insensitive.
ReturnsVARCHAR
Examples (2)

Classify EC2

SELECT focus.main.focus_service_category('aws', 'AmazonEC2') AS category;
SELECT focus.main.focus_service_category(p, s) AS c
FROM (VALUES ('aws', 'AmazonRDS', 1), ('azure', 'Virtual Machines', 2), ('gcp', 'Cloud Storage', 3), ('aws', 'NotAService', 4)) t(p, s, i)
ORDER BY i;
Link
focus_service_subcategory (provider VARCHAR, service VARCHAR) 2 examples

FOCUS ServiceSubcategory for a provider service, e.g. ('aws', 'AmazonRDS') -> 'Relational Databases'

Arguments
provider VARCHAR
Cloud provider; the spellings 'AWS', 'Microsoft' and 'Google Cloud' are accepted too. NULL in, NULL out.
service VARCHAR
Provider service key: AWS product code ('AmazonEC2'), Azure MeterCategory ('Virtual Machines'), GCP service description ('Compute Engine'); display names also match. Case-insensitive.
ReturnsVARCHAR
Examples (2)

Classify Cosmos DB

SELECT focus.main.focus_service_subcategory('azure', 'Azure Cosmos DB') AS subcategory;
SELECT focus.main.focus_service_subcategory('aws', 'AmazonRDS') AS a,
  focus.main.focus_service_subcategory('gcp', 'Cloud Run') AS b;
Link
focus_validate_value (column_name VARCHAR, value VARCHAR, spec_version VARCHAR) +1 overload 3 examples

NULL if a value is legal for a FOCUS 1.2 column, else the violation text

Arguments
column_name VARCHAR
FOCUS column name.
value VARCHAR
The value to check, as text.
spec_version VARCHAR
FOCUS version: '1.0' to '1.4'.
Overloads
focus_validate_value(column_name VARCHAR, value VARCHAR) → VARCHARfocus_validate_value(column_name VARCHAR, value VARCHAR, spec_version VARCHAR) → VARCHAR
ReturnsVARCHAR
Examples (3)

An invalid ChargeFrequency

SELECT focus.main.focus_validate_value('ChargeFrequency', 'Monthly') AS problem;

A lower-case ChargeCategory is rejected by FOCUS 1.0

SELECT focus.main.focus_validate_value('ChargeCategory', 'usage', '1.0') AS problem;
SELECT focus.main.focus_validate_value('ServiceProviderName', 'AWS', '1.2') AS v12,
  focus.main.focus_validate_value('ServiceProviderName', 'AWS', '1.3') AS v13;
Link
Table functions
focus (path VARCHAR, billing_period := VARCHAR, file_format := VARCHAR, money_scale := BIGINT, source := VARCHAR, spec_version := VARCHAR) 3 examples

Read AWS, Azure, GCP or native FOCUS billing export files as typed FOCUS 1.x rows

Positional arguments
path VARCHAR
Export file, directory (read recursively), glob ('exports/**/*.parquet'), http(s) URL, or s3:// / gs:// URI. Parquet, CSV (optionally .gz) and newline-delimited JSON are read by extension.
Named arguments
billing_period := VARCHAR
Only rows whose BillingPeriodStart falls in this month, 'YYYY-MM'. Prunes BILLING_PERIOD=YYYY-MM directories and Parquet row groups before reading. · default null
file_format := VARCHAR
File format override: 'auto' (by extension), 'parquet', 'csv' or 'json'. · default "auto"
money_scale := BIGINT
Decimal places kept on cost columns, 2 to 10 (default 6): BilledCost etc. are DECIMAL(19, money_scale). Values are rounded half-to-even; raise it to keep sub-microcent line items exactly. · default 6
source := VARCHAR
Export format: 'auto' (detect from the column names), 'aws_cur2' (AWS CUR 2.0 / Data Exports, also legacy CUR), 'azure' (Azure actual-cost export), 'azure_amortized' (Azure amortized-cost export), 'gcp' (BigQuery billing export dump) or 'focus' (any provider's native FOCUS file). · default "auto"
spec_version := VARCHAR
FOCUS version whose column set is returned: '1.0', '1.1', '1.2' (default), '1.3' or '1.4'. · default "1.2"
Returns columns
AllocatedMethodDetails VARCHAR
Recommended 1.3+
AllocatedMethodId VARCHAR
Conditional 1.3+
AllocatedResourceId VARCHAR
Conditional 1.3+
AllocatedResourceName VARCHAR
Conditional 1.3+
AllocatedTags MAP(VARCHAR, VARCHAR)
Conditional 1.3+
AvailabilityZone VARCHAR
Recommended 1.0+
BilledCost DECIMAL(19,6)
Mandatory 1.0+
BillingAccountId VARCHAR
Mandatory 1.0+
BillingAccountName VARCHAR
Mandatory 1.0+
BillingAccountType VARCHAR
Conditional 1.2+
BillingCurrency VARCHAR
Mandatory 1.0+
BillingPeriodEnd TIMESTAMPTZ
Mandatory 1.0+
BillingPeriodStart TIMESTAMPTZ
Mandatory 1.0+
CapacityReservationId VARCHAR
Conditional 1.1+
CapacityReservationStatus VARCHAR
Conditional 1.1+
ChargeCategory VARCHAR
Mandatory 1.0+
ChargeClass VARCHAR
Mandatory 1.0+
ChargeDescription VARCHAR
Mandatory 1.0+
ChargeFrequency VARCHAR
Recommended 1.0+
ChargePeriodEnd TIMESTAMPTZ
Mandatory 1.0+
ChargePeriodStart TIMESTAMPTZ
Mandatory 1.0+
CommitmentDiscountCategory VARCHAR
Conditional 1.0+
CommitmentDiscountId VARCHAR
Conditional 1.0+
CommitmentDiscountName VARCHAR
Conditional 1.0+
CommitmentDiscountQuantity DECIMAL(28,10)
Conditional 1.1+
CommitmentDiscountStatus VARCHAR
Conditional 1.0+
CommitmentDiscountType VARCHAR
Conditional 1.0+
CommitmentDiscountUnit VARCHAR
Conditional 1.1+
CommitmentProgramEligibilityDetails VARCHAR
Conditional 1.4+
ConsumedQuantity DECIMAL(28,10)
Conditional 1.0+
ConsumedUnit VARCHAR
Conditional 1.0+
ContractApplied VARCHAR
Conditional 1.3+
ContractedCost DECIMAL(19,6)
Mandatory 1.0+
ContractedUnitPrice DECIMAL(19,10)
Conditional 1.0+
EffectiveCost DECIMAL(19,6)
Mandatory 1.0+
HostProviderName VARCHAR
Mandatory 1.3+
InvoiceDetailId VARCHAR
Conditional 1.4+
InvoiceId VARCHAR
Conditional 1.2+
InvoiceIssuerName VARCHAR
Mandatory 1.0+
ListCost DECIMAL(19,6)
Mandatory 1.0+
ListUnitPrice DECIMAL(19,10)
Conditional 1.0+
PricingCategory VARCHAR
Conditional 1.0+
PricingCurrency VARCHAR
Conditional 1.2+
PricingCurrencyContractedUnitPrice DECIMAL(19,10)
Conditional 1.2+
PricingCurrencyEffectiveCost DECIMAL(19,6)
Conditional 1.2+
PricingCurrencyListUnitPrice DECIMAL(19,10)
Conditional 1.2+
PricingQuantity DECIMAL(28,10)
Mandatory 1.0+
PricingUnit VARCHAR
Mandatory 1.0+
ProviderName VARCHAR
Mandatory 1.0-1.3
PublisherName VARCHAR
Mandatory 1.0-1.3
RegionId VARCHAR
Conditional 1.0+
RegionName VARCHAR
Conditional 1.0+
ResourceId VARCHAR
Conditional 1.0+
ResourceName VARCHAR
Conditional 1.0+
ResourceType VARCHAR
Conditional 1.0+
ServiceCategory VARCHAR
Mandatory 1.0+
ServiceName VARCHAR
Mandatory 1.0+
ServiceProviderName VARCHAR
Mandatory 1.3+
ServiceSubcategory VARCHAR
Recommended 1.1+
SkuId VARCHAR
Conditional 1.0+
SkuMeter VARCHAR
Conditional 1.1+
SkuPriceDetails VARCHAR
Conditional 1.1+
SkuPriceId VARCHAR
Conditional 1.0+
SubAccountId VARCHAR
Conditional 1.0+
SubAccountName VARCHAR
Conditional 1.0+
SubAccountType VARCHAR
Conditional 1.2+
Tags MAP(VARCHAR, VARCHAR)
Conditional 1.0+
x_SourceFormat VARCHAR
extension
x_SourceFile VARCHAR
extension
x_ServiceCode VARCHAR
extension
x_UsageType VARCHAR
extension
x_Operation VARCHAR
extension
x_ChargeType VARCHAR
extension
Returns columns · depends on the arguments
AllocatedMethodDetails VARCHAR
Recommended 1.3+
AllocatedMethodId VARCHAR
Conditional 1.3+
AllocatedResourceId VARCHAR
Conditional 1.3+
AllocatedResourceName VARCHAR
Conditional 1.3+
AllocatedTags MAP(VARCHAR, VARCHAR)
Conditional 1.3+
AvailabilityZone VARCHAR
Recommended 1.0+
BilledCost DECIMAL(19,6)
Mandatory 1.0+
BillingAccountId VARCHAR
Mandatory 1.0+
BillingAccountName VARCHAR
Mandatory 1.0+
BillingAccountType VARCHAR
Conditional 1.2+
BillingCurrency VARCHAR
Mandatory 1.0+
BillingPeriodEnd TIMESTAMPTZ
Mandatory 1.0+
BillingPeriodStart TIMESTAMPTZ
Mandatory 1.0+
CapacityReservationId VARCHAR
Conditional 1.1+
CapacityReservationStatus VARCHAR
Conditional 1.1+
ChargeCategory VARCHAR
Mandatory 1.0+
ChargeClass VARCHAR
Mandatory 1.0+
ChargeDescription VARCHAR
Mandatory 1.0+
ChargeFrequency VARCHAR
Recommended 1.0+
ChargePeriodEnd TIMESTAMPTZ
Mandatory 1.0+
ChargePeriodStart TIMESTAMPTZ
Mandatory 1.0+
CommitmentDiscountCategory VARCHAR
Conditional 1.0+
CommitmentDiscountId VARCHAR
Conditional 1.0+
CommitmentDiscountName VARCHAR
Conditional 1.0+
CommitmentDiscountQuantity DECIMAL(28,10)
Conditional 1.1+
CommitmentDiscountStatus VARCHAR
Conditional 1.0+
CommitmentDiscountType VARCHAR
Conditional 1.0+
CommitmentDiscountUnit VARCHAR
Conditional 1.1+
CommitmentProgramEligibilityDetails VARCHAR
Conditional 1.4+
ConsumedQuantity DECIMAL(28,10)
Conditional 1.0+
ConsumedUnit VARCHAR
Conditional 1.0+
ContractApplied VARCHAR
Conditional 1.3+
ContractedCost DECIMAL(19,6)
Mandatory 1.0+
ContractedUnitPrice DECIMAL(19,10)
Conditional 1.0+
EffectiveCost DECIMAL(19,6)
Mandatory 1.0+
HostProviderName VARCHAR
Mandatory 1.3+
InvoiceDetailId VARCHAR
Conditional 1.4+
InvoiceId VARCHAR
Conditional 1.2+
InvoiceIssuerName VARCHAR
Mandatory 1.0+
ListCost DECIMAL(19,6)
Mandatory 1.0+
ListUnitPrice DECIMAL(19,10)
Conditional 1.0+
PricingCategory VARCHAR
Conditional 1.0+
PricingCurrency VARCHAR
Conditional 1.2+
PricingCurrencyContractedUnitPrice DECIMAL(19,10)
Conditional 1.2+
PricingCurrencyEffectiveCost DECIMAL(19,6)
Conditional 1.2+
PricingCurrencyListUnitPrice DECIMAL(19,10)
Conditional 1.2+
PricingQuantity DECIMAL(28,10)
Mandatory 1.0+
PricingUnit VARCHAR
Mandatory 1.0+
ProviderName VARCHAR
Mandatory 1.0-1.3
PublisherName VARCHAR
Mandatory 1.0-1.3
RegionId VARCHAR
Conditional 1.0+
RegionName VARCHAR
Conditional 1.0+
ResourceId VARCHAR
Conditional 1.0+
ResourceName VARCHAR
Conditional 1.0+
ResourceType VARCHAR
Conditional 1.0+
ServiceCategory VARCHAR
Mandatory 1.0+
ServiceName VARCHAR
Mandatory 1.0+
ServiceProviderName VARCHAR
Mandatory 1.3+
ServiceSubcategory VARCHAR
Recommended 1.1+
SkuId VARCHAR
Conditional 1.0+
SkuMeter VARCHAR
Conditional 1.1+
SkuPriceDetails VARCHAR
Conditional 1.1+
SkuPriceId VARCHAR
Conditional 1.0+
SubAccountId VARCHAR
Conditional 1.0+
SubAccountName VARCHAR
Conditional 1.0+
SubAccountType VARCHAR
Conditional 1.2+
Tags MAP(VARCHAR, VARCHAR)
Conditional 1.0+
x_SourceFormat VARCHAR
extension
x_SourceFile VARCHAR
extension
x_ServiceCode VARCHAR
extension
x_UsageType VARCHAR
extension
x_Operation VARCHAR
extension
x_ChargeType VARCHAR
extension
Examples (3)

Amortized spend by cloud and service category across AWS, Azure and GCP exports

SELECT ProviderName, ServiceCategory, sum(EffectiveCost) AS effective_cost
FROM (SELECT * FROM focus.main.focus('sample://aws_cur2') UNION ALL SELECT * FROM focus.main.focus('sample://azure/contoso-actual-cost-202607.csv') UNION ALL SELECT * FROM focus.main.focus('sample://gcp/gcp_billing_export_v1_01A2B3_202607.parquet'))
GROUP BY ALL
ORDER BY effective_cost DESC;
Result · first 5 rows
ProviderName ServiceCategory effective_cost
AWS Compute 377.54
Google Cloud Other 318.75
AWS Other 300
AWS Databases 262.25
Google Cloud Compute 220.86

July invoice cost by team tag in the AWS CUR 2.0 sample

SELECT Tags['team'] AS team, sum(BilledCost) AS billed
FROM focus.main.focus('sample://aws_cur2', billing_period := '2026-07')
WHERE Tags['team'] IS NOT NULL
GROUP BY team
ORDER BY billed DESC;
SELECT ChargeCategory, sum(BilledCost) AS billed,
  sum(EffectiveCost) AS effective
FROM focus.main.focus('sample://aws_cur2', billing_period := '2026-07')
GROUP BY ChargeCategory
ORDER BY ChargeCategory;
Link
focus_validate (path VARCHAR, file_format := VARCHAR, source := VARCHAR, spec_version := VARCHAR) 2 examples

Check billing export files against the FOCUS spec: required columns, nulls, allowed values

Positional arguments
path VARCHAR
Export file, directory (read recursively), glob ('exports/**/*.parquet'), http(s) URL, or s3:// / gs:// URI. Parquet, CSV (optionally .gz) and newline-delimited JSON are read by extension.
Named arguments
file_format := VARCHAR
File format override: 'auto' (by extension), 'parquet', 'csv' or 'json'. · default "auto"
source := VARCHAR
Export format, as for focus(): 'auto', 'aws_cur2', 'azure', 'azure_amortized', 'gcp' or 'focus'. · default "auto"
spec_version := VARCHAR
FOCUS version whose column set is returned: '1.0', '1.1', '1.2' (default), '1.3' or '1.4'. · default "1.2"
Returns columns
check_name VARCHAR
Check id, e.g. 'not_null', 'allowed_values', 'column_present'.
column_name VARCHAR
FOCUS column checked; NULL for file-level checks.
severity VARCHAR
'error' (spec MUST), 'warning' (SHOULD / likely wrong) or 'info'.
status VARCHAR
'pass', 'fail' or 'not_applicable'.
rows_checked BIGINT
Rows the check looked at.
failing_rows BIGINT
Rows (or columns, for file-level checks) that failed.
sample_value VARCHAR
One offending value, for diagnosis; NULL when passing.
detail VARCHAR
What the rule requires.
Examples (2)

Checks a native FOCUS 1.2 export does not pass as FOCUS 1.3

SELECT check_name, column_name, status
FROM focus.main.focus_validate('sample://focus12', spec_version := '1.3')
WHERE status <> 'pass'
ORDER BY check_name, column_name;

Error-level checks of the mapped GCP billing export sample

SELECT check_name, column_name, failing_rows, sample_value
FROM focus.main.focus_validate('sample://gcp/gcp_billing_export_v1_01A2B3_202607.parquet')
WHERE severity = 'error'
ORDER BY failing_rows DESC, check_name;
Link
Table in-out functions
to_focus (data TABLE, money_scale := BIGINT, source := VARCHAR, spec_version := VARCHAR) 1 example

Map raw AWS, Azure, GCP or FOCUS billing rows from any DuckDB query to typed FOCUS rows

Positional arguments
data TABLE
Raw billing rows from a subquery, with the export's own column names.
Named arguments
money_scale := BIGINT
Decimal places kept on cost columns, 2 to 10 (default 6): BilledCost etc. are DECIMAL(19, money_scale). Values are rounded half-to-even; raise it to keep sub-microcent line items exactly. · default 6
source := VARCHAR
Format of the input rows: 'auto' (detect from the column names), 'aws_cur2', 'azure', 'azure_amortized', 'gcp' or 'focus'. · default "auto"
spec_version := VARCHAR
FOCUS version whose column set is returned: '1.0', '1.1', '1.2' (default), '1.3' or '1.4'. · default "1.2"
Returns columns
AllocatedMethodDetails VARCHAR
Recommended 1.3+
AllocatedMethodId VARCHAR
Conditional 1.3+
AllocatedResourceId VARCHAR
Conditional 1.3+
AllocatedResourceName VARCHAR
Conditional 1.3+
AllocatedTags MAP(VARCHAR, VARCHAR)
Conditional 1.3+
AvailabilityZone VARCHAR
Recommended 1.0+
BilledCost DECIMAL(19,6)
Mandatory 1.0+
BillingAccountId VARCHAR
Mandatory 1.0+
BillingAccountName VARCHAR
Mandatory 1.0+
BillingAccountType VARCHAR
Conditional 1.2+
BillingCurrency VARCHAR
Mandatory 1.0+
BillingPeriodEnd TIMESTAMPTZ
Mandatory 1.0+
BillingPeriodStart TIMESTAMPTZ
Mandatory 1.0+
CapacityReservationId VARCHAR
Conditional 1.1+
CapacityReservationStatus VARCHAR
Conditional 1.1+
ChargeCategory VARCHAR
Mandatory 1.0+
ChargeClass VARCHAR
Mandatory 1.0+
ChargeDescription VARCHAR
Mandatory 1.0+
ChargeFrequency VARCHAR
Recommended 1.0+
ChargePeriodEnd TIMESTAMPTZ
Mandatory 1.0+
ChargePeriodStart TIMESTAMPTZ
Mandatory 1.0+
CommitmentDiscountCategory VARCHAR
Conditional 1.0+
CommitmentDiscountId VARCHAR
Conditional 1.0+
CommitmentDiscountName VARCHAR
Conditional 1.0+
CommitmentDiscountQuantity DECIMAL(28,10)
Conditional 1.1+
CommitmentDiscountStatus VARCHAR
Conditional 1.0+
CommitmentDiscountType VARCHAR
Conditional 1.0+
CommitmentDiscountUnit VARCHAR
Conditional 1.1+
CommitmentProgramEligibilityDetails VARCHAR
Conditional 1.4+
ConsumedQuantity DECIMAL(28,10)
Conditional 1.0+
ConsumedUnit VARCHAR
Conditional 1.0+
ContractApplied VARCHAR
Conditional 1.3+
ContractedCost DECIMAL(19,6)
Mandatory 1.0+
ContractedUnitPrice DECIMAL(19,10)
Conditional 1.0+
EffectiveCost DECIMAL(19,6)
Mandatory 1.0+
HostProviderName VARCHAR
Mandatory 1.3+
InvoiceDetailId VARCHAR
Conditional 1.4+
InvoiceId VARCHAR
Conditional 1.2+
InvoiceIssuerName VARCHAR
Mandatory 1.0+
ListCost DECIMAL(19,6)
Mandatory 1.0+
ListUnitPrice DECIMAL(19,10)
Conditional 1.0+
PricingCategory VARCHAR
Conditional 1.0+
PricingCurrency VARCHAR
Conditional 1.2+
PricingCurrencyContractedUnitPrice DECIMAL(19,10)
Conditional 1.2+
PricingCurrencyEffectiveCost DECIMAL(19,6)
Conditional 1.2+
PricingCurrencyListUnitPrice DECIMAL(19,10)
Conditional 1.2+
PricingQuantity DECIMAL(28,10)
Mandatory 1.0+
PricingUnit VARCHAR
Mandatory 1.0+
ProviderName VARCHAR
Mandatory 1.0-1.3
PublisherName VARCHAR
Mandatory 1.0-1.3
RegionId VARCHAR
Conditional 1.0+
RegionName VARCHAR
Conditional 1.0+
ResourceId VARCHAR
Conditional 1.0+
ResourceName VARCHAR
Conditional 1.0+
ResourceType VARCHAR
Conditional 1.0+
ServiceCategory VARCHAR
Mandatory 1.0+
ServiceName VARCHAR
Mandatory 1.0+
ServiceProviderName VARCHAR
Mandatory 1.3+
ServiceSubcategory VARCHAR
Recommended 1.1+
SkuId VARCHAR
Conditional 1.0+
SkuMeter VARCHAR
Conditional 1.1+
SkuPriceDetails VARCHAR
Conditional 1.1+
SkuPriceId VARCHAR
Conditional 1.0+
SubAccountId VARCHAR
Conditional 1.0+
SubAccountName VARCHAR
Conditional 1.0+
SubAccountType VARCHAR
Conditional 1.2+
Tags MAP(VARCHAR, VARCHAR)
Conditional 1.0+
x_SourceFormat VARCHAR
extension
x_SourceFile VARCHAR
extension
x_ServiceCode VARCHAR
extension
x_UsageType VARCHAR
extension
x_Operation VARCHAR
extension
x_ChargeType VARCHAR
extension
Returns columns · depends on the arguments
AllocatedMethodDetails VARCHAR
Recommended 1.3+
AllocatedMethodId VARCHAR
Conditional 1.3+
AllocatedResourceId VARCHAR
Conditional 1.3+
AllocatedResourceName VARCHAR
Conditional 1.3+
AllocatedTags MAP(VARCHAR, VARCHAR)
Conditional 1.3+
AvailabilityZone VARCHAR
Recommended 1.0+
BilledCost DECIMAL(19,6)
Mandatory 1.0+
BillingAccountId VARCHAR
Mandatory 1.0+
BillingAccountName VARCHAR
Mandatory 1.0+
BillingAccountType VARCHAR
Conditional 1.2+
BillingCurrency VARCHAR
Mandatory 1.0+
BillingPeriodEnd TIMESTAMPTZ
Mandatory 1.0+
BillingPeriodStart TIMESTAMPTZ
Mandatory 1.0+
CapacityReservationId VARCHAR
Conditional 1.1+
CapacityReservationStatus VARCHAR
Conditional 1.1+
ChargeCategory VARCHAR
Mandatory 1.0+
ChargeClass VARCHAR
Mandatory 1.0+
ChargeDescription VARCHAR
Mandatory 1.0+
ChargeFrequency VARCHAR
Recommended 1.0+
ChargePeriodEnd TIMESTAMPTZ
Mandatory 1.0+
ChargePeriodStart TIMESTAMPTZ
Mandatory 1.0+
CommitmentDiscountCategory VARCHAR
Conditional 1.0+
CommitmentDiscountId VARCHAR
Conditional 1.0+
CommitmentDiscountName VARCHAR
Conditional 1.0+
CommitmentDiscountQuantity DECIMAL(28,10)
Conditional 1.1+
CommitmentDiscountStatus VARCHAR
Conditional 1.0+
CommitmentDiscountType VARCHAR
Conditional 1.0+
CommitmentDiscountUnit VARCHAR
Conditional 1.1+
CommitmentProgramEligibilityDetails VARCHAR
Conditional 1.4+
ConsumedQuantity DECIMAL(28,10)
Conditional 1.0+
ConsumedUnit VARCHAR
Conditional 1.0+
ContractApplied VARCHAR
Conditional 1.3+
ContractedCost DECIMAL(19,6)
Mandatory 1.0+
ContractedUnitPrice DECIMAL(19,10)
Conditional 1.0+
EffectiveCost DECIMAL(19,6)
Mandatory 1.0+
HostProviderName VARCHAR
Mandatory 1.3+
InvoiceDetailId VARCHAR
Conditional 1.4+
InvoiceId VARCHAR
Conditional 1.2+
InvoiceIssuerName VARCHAR
Mandatory 1.0+
ListCost DECIMAL(19,6)
Mandatory 1.0+
ListUnitPrice DECIMAL(19,10)
Conditional 1.0+
PricingCategory VARCHAR
Conditional 1.0+
PricingCurrency VARCHAR
Conditional 1.2+
PricingCurrencyContractedUnitPrice DECIMAL(19,10)
Conditional 1.2+
PricingCurrencyEffectiveCost DECIMAL(19,6)
Conditional 1.2+
PricingCurrencyListUnitPrice DECIMAL(19,10)
Conditional 1.2+
PricingQuantity DECIMAL(28,10)
Mandatory 1.0+
PricingUnit VARCHAR
Mandatory 1.0+
ProviderName VARCHAR
Mandatory 1.0-1.3
PublisherName VARCHAR
Mandatory 1.0-1.3
RegionId VARCHAR
Conditional 1.0+
RegionName VARCHAR
Conditional 1.0+
ResourceId VARCHAR
Conditional 1.0+
ResourceName VARCHAR
Conditional 1.0+
ResourceType VARCHAR
Conditional 1.0+
ServiceCategory VARCHAR
Mandatory 1.0+
ServiceName VARCHAR
Mandatory 1.0+
ServiceProviderName VARCHAR
Mandatory 1.3+
ServiceSubcategory VARCHAR
Recommended 1.1+
SkuId VARCHAR
Conditional 1.0+
SkuMeter VARCHAR
Conditional 1.1+
SkuPriceDetails VARCHAR
Conditional 1.1+
SkuPriceId VARCHAR
Conditional 1.0+
SubAccountId VARCHAR
Conditional 1.0+
SubAccountName VARCHAR
Conditional 1.0+
SubAccountType VARCHAR
Conditional 1.2+
Tags MAP(VARCHAR, VARCHAR)
Conditional 1.0+
x_SourceFormat VARCHAR
extension
x_SourceFile VARCHAR
extension
x_ServiceCode VARCHAR
extension
x_UsageType VARCHAR
extension
x_Operation VARCHAR
extension
x_ChargeType VARCHAR
extension
Example

Map raw CUR 2.0 rows written inline to FOCUS

SELECT ChargeCategory, CommitmentDiscountStatus, BilledCost, EffectiveCost
FROM focus.main.to_focus((SELECT * FROM (VALUES ('Usage', 1.9584, NULL, NULL), ('SavingsPlanCoveredUsage', 3.9168, 2.7408, 'arn:aws:savingsplans::1:savingsplan/x')) AS t(line_item_line_item_type, line_item_unblended_cost, savings_plan_savings_plan_effective_cost, savings_plan_savings_plan_a_r_n)))
ORDER BY BilledCost;
Link

Try these queries

July invoice cost by team tag in the AWS CUR 2.0 sample

SELECT Tags['team'] AS team, sum(BilledCost) AS billed
FROM focus.main.focus('sample://aws_cur2', billing_period := '2026-07')
WHERE Tags['team'] IS NOT NULL
GROUP BY team
ORDER BY billed DESC

Uses focus

Map raw CUR 2.0 rows written inline to FOCUS

SELECT ChargeCategory, CommitmentDiscountStatus, BilledCost, EffectiveCost
FROM focus.main.to_focus((SELECT * FROM (VALUES ('Usage', 1.9584, NULL, NULL), ('SavingsPlanCoveredUsage', 3.9168, 2.7408, 'arn:aws:savingsplans::1:savingsplan/x')) AS t(line_item_line_item_type, line_item_unblended_cost, savings_plan_savings_plan_effective_cost, savings_plan_savings_plan_a_r_n)))
ORDER BY BilledCost

Uses to_focus

Checks a native FOCUS 1.2 export does not pass as FOCUS 1.3

SELECT check_name, column_name, status
FROM focus.main.focus_validate('sample://focus12', spec_version := '1.3')
WHERE status <> 'pass'
ORDER BY check_name, column_name

Uses focus_validate

Classify EC2

SELECT focus.main.focus_service_category('aws', 'AmazonEC2') AS category

Uses focus_service_category

Classify Cosmos DB

SELECT focus.main.focus_service_subcategory('azure', 'Azure Cosmos DB') AS subcategory

Uses focus_service_subcategory

AWS reserved-instance fee

SELECT focus.main.focus_charge_category('aws', 'RIFee') AS category

Uses focus_charge_category

21 more examples in the Catalog, each listed under the table or function it uses.

Questions it can answer

Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.

  • The bundled Azure sample sample://azure/contoso-amortized-cost-202607.parquet is an amortized-cost export. What is its effective cost per FOCUS ServiceCategory?
  • Validate the bundled native FOCUS 1.2 export sample://focus12 against FOCUS 1.3. Which checks are not passing? Give check name, column and status.
  • How many columns does FOCUS version 1.2 define as Mandatory?
  • Which raw AWS CUR 2.0 columns does the focus worker read to compute EffectiveCost?
  • How many Azure services in the focus worker's service classification map to the Databases category?
  • Which AWS line item types does the focus worker classify as the FOCUS Credit charge category?

FOCUS cloud costs is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.