:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(warehouse_sources): read Stripe fields that basil relocated (#94533)
Daniel RC5f8bc937a84b
diff --git a/posthog/hogql/database/schema/test/__snapshots__/test_groups_revenue_analytics.ambr b/posthog/hogql/database/schema/test/__snapshots__/test_groups_revenue_analytics.ambrindex 9436a78c728f..cf94ffcedbe0 100644--- a/posthog/hogql/database/schema/test/__snapshots__/test_groups_revenue_analytics.ambr+++ b/posthog/hogql/database/schema/test/__snapshots__/test_groups_revenue_analytics.ambr@@ -352,7 +352,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_analytics_revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_analytics_revenue_itemGROUP BY customer_id) AS revenue_agg ON equals(revenue_analytics_customer.id, revenue_agg.customer_id)LEFT JOIN(SELECT `stripe.posthog_test.mrr_revenue_view`.customer_id AS customer_id,@@ -415,7 +415,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_itemWHERE and(revenue_item.is_recurring, isNotNull(revenue_item.subscription_id), ifNull(greaterOrEquals(timestamp, toStartOfMonth(addDays(toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC'), -60))), 0), ifNull(lessOrEquals(timestamp, toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC')), 0))GROUP BY revenue_item.source_label,revenue_item.customer_id,@@ -798,7 +798,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_analytics_revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_analytics_revenue_itemGROUP BY customer_id) AS revenue_agg ON equals(revenue_analytics_customer.id, revenue_agg.customer_id)LEFT JOIN(SELECT `stripe.posthog_test.mrr_revenue_view`.customer_id AS customer_id,@@ -861,7 +861,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_itemWHERE and(revenue_item.is_recurring, isNotNull(revenue_item.subscription_id), ifNull(greaterOrEquals(timestamp, toStartOfMonth(addDays(toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC'), -60))), 0), ifNull(lessOrEquals(timestamp, toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC')), 0))GROUP BY revenue_item.source_label,revenue_item.customer_id,@@ -1039,7 +1039,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_analytics_revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_analytics_revenue_itemGROUP BY customer_id) AS revenue_agg ON equals(revenue_analytics_customer.id, revenue_agg.customer_id)LEFT JOIN(SELECT `stripe.posthog_test.mrr_revenue_view`.customer_id AS customer_id,@@ -1102,7 +1102,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_itemWHERE and(revenue_item.is_recurring, isNotNull(revenue_item.subscription_id), ifNull(greaterOrEquals(timestamp, toStartOfMonth(addDays(toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC'), -60))), 0), ifNull(lessOrEquals(timestamp, toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC')), 0))GROUP BY revenue_item.source_label,revenue_item.customer_id,@@ -1280,7 +1280,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_analytics_revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_analytics_revenue_itemGROUP BY customer_id) AS revenue_agg ON equals(revenue_analytics_customer.id, revenue_agg.customer_id)LEFT JOIN(SELECT `stripe.posthog_test.mrr_revenue_view`.customer_id AS customer_id,@@ -1343,7 +1343,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_itemWHERE and(revenue_item.is_recurring, isNotNull(revenue_item.subscription_id), ifNull(greaterOrEquals(timestamp, toStartOfMonth(addDays(toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC'), -60))), 0), ifNull(lessOrEquals(timestamp, toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC')), 0))GROUP BY revenue_item.source_label,revenue_item.customer_id,@@ -1521,7 +1521,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_analytics_revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_analytics_revenue_itemGROUP BY customer_id) AS revenue_agg ON equals(revenue_analytics_customer.id, revenue_agg.customer_id)LEFT JOIN(SELECT `stripe.posthog_test.mrr_revenue_view`.customer_id AS customer_id,@@ -1584,7 +1584,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_itemWHERE and(revenue_item.is_recurring, isNotNull(revenue_item.subscription_id), ifNull(greaterOrEquals(timestamp, toStartOfMonth(addDays(toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC'), -60))), 0), ifNull(lessOrEquals(timestamp, toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC')), 0))GROUP BY revenue_item.source_label,revenue_item.customer_id,@@ -1763,7 +1763,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_analytics_revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_analytics_revenue_itemGROUP BY customer_id) AS revenue_agg ON equals(revenue_analytics_customer.id, revenue_agg.customer_id)LEFT JOIN(SELECT `stripe.posthog_test.mrr_revenue_view`.customer_id AS customer_id,@@ -1826,7 +1826,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_itemWHERE and(revenue_item.is_recurring, isNotNull(revenue_item.subscription_id), ifNull(greaterOrEquals(timestamp, toStartOfMonth(addDays(toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC'), -60))), 0), ifNull(lessOrEquals(timestamp, toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC')), 0))GROUP BY revenue_item.source_label,revenue_item.customer_id,@@ -2212,7 +2212,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_analytics_revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_analytics_revenue_itemGROUP BY customer_id) AS revenue_agg ON equals(revenue_analytics_customer.id, revenue_agg.customer_id)LEFT JOIN(SELECT `stripe.posthog_test.mrr_revenue_view`.customer_id AS customer_id,@@ -2275,7 +2275,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_itemWHERE and(revenue_item.is_recurring, isNotNull(revenue_item.subscription_id), ifNull(greaterOrEquals(timestamp, toStartOfMonth(addDays(toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC'), -60))), 0), ifNull(lessOrEquals(timestamp, toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC')), 0))GROUP BY revenue_item.source_label,revenue_item.customer_id,diff --git a/posthog/hogql/database/schema/test/__snapshots__/test_persons_revenue_analytics.ambr b/posthog/hogql/database/schema/test/__snapshots__/test_persons_revenue_analytics.ambrindex 941237a006d5..4df9d56c148c 100644--- a/posthog/hogql/database/schema/test/__snapshots__/test_persons_revenue_analytics.ambr+++ b/posthog/hogql/database/schema/test/__snapshots__/test_persons_revenue_analytics.ambr@@ -346,7 +346,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_analytics_revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_analytics_revenue_itemGROUP BY customer_id) AS revenue_agg ON equals(revenue_analytics_customer.id, revenue_agg.customer_id)LEFT JOIN(SELECT `stripe.posthog_test.mrr_revenue_view`.customer_id AS customer_id,@@ -409,7 +409,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_itemWHERE and(revenue_item.is_recurring, isNotNull(revenue_item.subscription_id), ifNull(greaterOrEquals(timestamp, toStartOfMonth(addDays(toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC'), -60))), 0), ifNull(lessOrEquals(timestamp, toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC')), 0))GROUP BY revenue_item.source_label,revenue_item.customer_id,@@ -598,7 +598,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_analytics_revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_analytics_revenue_itemGROUP BY customer_id) AS revenue_agg ON equals(revenue_analytics_customer.id, revenue_agg.customer_id)LEFT JOIN(SELECT `stripe.posthog_test.mrr_revenue_view`.customer_id AS customer_id,@@ -661,7 +661,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_itemWHERE and(revenue_item.is_recurring, isNotNull(revenue_item.subscription_id), ifNull(greaterOrEquals(timestamp, toStartOfMonth(addDays(toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC'), -60))), 0), ifNull(lessOrEquals(timestamp, toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC')), 0))GROUP BY revenue_item.source_label,revenue_item.customer_id,@@ -852,7 +852,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_analytics_revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_analytics_revenue_itemGROUP BY customer_id) AS revenue_agg ON equals(revenue_analytics_customer.id, revenue_agg.customer_id)LEFT JOIN(SELECT `stripe.posthog_test.mrr_revenue_view`.customer_id AS customer_id,@@ -915,7 +915,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_itemWHERE and(revenue_item.is_recurring, isNotNull(revenue_item.subscription_id), ifNull(greaterOrEquals(timestamp, toStartOfMonth(addDays(toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC'), -60))), 0), ifNull(lessOrEquals(timestamp, toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC')), 0))GROUP BY revenue_item.source_label,revenue_item.customer_id,@@ -1105,7 +1105,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_analytics_revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_analytics_revenue_itemGROUP BY customer_id) AS revenue_agg ON equals(revenue_analytics_customer.id, revenue_agg.customer_id)LEFT JOIN(SELECT `stripe.posthog_test.mrr_revenue_view`.customer_id AS customer_id,@@ -1168,7 +1168,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_itemWHERE and(revenue_item.is_recurring, isNotNull(revenue_item.subscription_id), ifNull(greaterOrEquals(timestamp, toStartOfMonth(addDays(toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC'), -60))), 0), ifNull(lessOrEquals(timestamp, toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC')), 0))GROUP BY revenue_item.source_label,revenue_item.customer_id,@@ -1358,7 +1358,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_analytics_revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_analytics_revenue_itemGROUP BY customer_id) AS revenue_agg ON equals(revenue_analytics_customer.id, revenue_agg.customer_id)LEFT JOIN(SELECT `stripe.posthog_test.mrr_revenue_view`.customer_id AS customer_id,@@ -1421,7 +1421,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_itemWHERE and(revenue_item.is_recurring, isNotNull(revenue_item.subscription_id), ifNull(greaterOrEquals(timestamp, toStartOfMonth(addDays(toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC'), -60))), 0), ifNull(lessOrEquals(timestamp, toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC')), 0))GROUP BY revenue_item.source_label,revenue_item.customer_id,@@ -1612,7 +1612,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_analytics_revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_analytics_revenue_itemGROUP BY customer_id) AS revenue_agg ON equals(revenue_analytics_customer.id, revenue_agg.customer_id)LEFT JOIN(SELECT `stripe.posthog_test.mrr_revenue_view`.customer_id AS customer_id,@@ -1675,7 +1675,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_itemWHERE and(revenue_item.is_recurring, isNotNull(revenue_item.subscription_id), ifNull(greaterOrEquals(timestamp, toStartOfMonth(addDays(toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC'), -60))), 0), ifNull(lessOrEquals(timestamp, toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC')), 0))GROUP BY revenue_item.source_label,revenue_item.customer_id,@@ -2067,7 +2067,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_analytics_revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_analytics_revenue_itemGROUP BY customer_id) AS revenue_agg ON equals(revenue_analytics_customer.id, revenue_agg.customer_id)LEFT JOIN(SELECT `stripe.posthog_test.mrr_revenue_view`.customer_id AS customer_id,@@ -2130,7 +2130,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_itemWHERE and(revenue_item.is_recurring, isNotNull(revenue_item.subscription_id), ifNull(greaterOrEquals(timestamp, toStartOfMonth(addDays(toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC'), -60))), 0), ifNull(lessOrEquals(timestamp, toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC')), 0))GROUP BY revenue_item.source_label,revenue_item.customer_id,@@ -2561,7 +2561,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_analytics_revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_analytics_revenue_itemGROUP BY customer_id) AS revenue_agg ON equals(revenue_analytics_customer.id, revenue_agg.customer_id)LEFT JOIN(SELECT `stripe.posthog_test.mrr_revenue_view`.customer_id AS customer_id,@@ -2624,7 +2624,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_itemWHERE and(revenue_item.is_recurring, isNotNull(revenue_item.subscription_id), ifNull(greaterOrEquals(timestamp, toStartOfMonth(addDays(toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC'), -60))), 0), ifNull(lessOrEquals(timestamp, toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC')), 0))GROUP BY revenue_item.source_label,revenue_item.customer_id,@@ -2790,7 +2790,7 @@FROM (SELECT posthog_test_stripe_invoice.id AS id, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC') AS created_at, posthog_test_stripe_invoice.customer AS customer_id, posthog_test_stripe_invoice.subscription AS subscription_id, posthog_test_stripe_invoice.discount AS discount, arrayJoin(JSONExtractArrayRaw(assumeNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(posthog_test_stripe_invoice.lines, 'data'), ''), 'null'), '^"|"$', '')))) AS data, JSONExtractString(data, 'id') AS invoice_item_id, JSONExtractUInt(data, 'amount') AS amount_before_discount, coalesce(arraySum(arrayMap(x -> JSONExtractInt(x, 'amount'), JSONExtractArrayRaw(data, 'discount_amounts'))), 0) AS discount_amount, greatest(minus(amount_before_discount, discount_amount), 0) AS amount_captured, JSONExtractString(data, 'currency') AS currency, JSONExtractString(data, 'price', 'product') AS product_id, fromUnixTimestamp(JSONExtractUInt(data, 'period', 'start')) AS period_start, fromUnixTimestamp(JSONExtractUInt(data, 'period', 'end')) AS period_end, greatest(toInt16(round(divide(dateDiff('day', ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')), ifNull(period_end, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC'))), 30.44))), 1) AS period_months, arrayJoin(range(0, period_months)) AS month_index, ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_analytics_revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_analytics_revenue_itemGROUP BY customer_id) AS revenue_agg ON equals(revenue_analytics_customer.id, revenue_agg.customer_id)LEFT JOIN (SELECT `stripe.posthog_test.mrr_revenue_view`.customer_id AS customer_id, sum(`stripe.posthog_test.mrr_revenue_view`.mrr) AS mrr@@ -2803,7 +2803,7 @@FROM (SELECT posthog_test_stripe_invoice.id AS id, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC') AS created_at, posthog_test_stripe_invoice.customer AS customer_id, posthog_test_stripe_invoice.subscription AS subscription_id, posthog_test_stripe_invoice.discount AS discount, arrayJoin(JSONExtractArrayRaw(assumeNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(posthog_test_stripe_invoice.lines, 'data'), ''), 'null'), '^"|"$', '')))) AS data, JSONExtractString(data, 'id') AS invoice_item_id, JSONExtractUInt(data, 'amount') AS amount_before_discount, coalesce(arraySum(arrayMap(x -> JSONExtractInt(x, 'amount'), JSONExtractArrayRaw(data, 'discount_amounts'))), 0) AS discount_amount, greatest(minus(amount_before_discount, discount_amount), 0) AS amount_captured, JSONExtractString(data, 'currency') AS currency, JSONExtractString(data, 'price', 'product') AS product_id, fromUnixTimestamp(JSONExtractUInt(data, 'period', 'start')) AS period_start, fromUnixTimestamp(JSONExtractUInt(data, 'period', 'end')) AS period_end, greatest(toInt16(round(divide(dateDiff('day', ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')), ifNull(period_end, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC'))), 30.44))), 1) AS period_months, arrayJoin(range(0, period_months)) AS month_index, ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_item WHERE and(revenue_item.is_recurring, isNotNull(revenue_item.subscription_id), ifNull(greaterOrEquals(timestamp, toStartOfMonth(addDays(toDateTime64('explicit_redacted_timestamp', 6, 'UTC'), -60))), 0), ifNull(lessOrEquals(timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), 0))+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_item WHERE and(revenue_item.is_recurring, isNotNull(revenue_item.subscription_id), ifNull(greaterOrEquals(timestamp, toStartOfMonth(addDays(toDateTime64('explicit_redacted_timestamp', 6, 'UTC'), -60))), 0), ifNull(lessOrEquals(timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), 0))GROUP BY revenue_item.source_label, revenue_item.customer_id, revenue_item.subscription_id, timestampORDER BY timestamp DESCUNION ALL@@ -2956,7 +2956,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_analytics_revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_analytics_revenue_itemGROUP BY customer_id) AS revenue_agg ON equals(revenue_analytics_customer.id, revenue_agg.customer_id)LEFT JOIN(SELECT `stripe.posthog_test.mrr_revenue_view`.customer_id AS customer_id,@@ -3019,7 +3019,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_itemWHERE and(revenue_item.is_recurring, isNotNull(revenue_item.subscription_id), ifNull(greaterOrEquals(timestamp, toStartOfMonth(addDays(toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC'), -60))), 0), ifNull(lessOrEquals(timestamp, toDateTime64('2025-05-30 00:00:00.000000', 6, 'UTC')), 0))GROUP BY revenue_item.source_label,revenue_item.customer_id,@@ -3345,7 +3345,8 @@'object_storage_root_password','CSVWithNames','`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_analytics_revenue_item+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status,+ 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_analytics_revenue_itemGROUP BY customer_id) AS revenue_agg ON equals(revenue_analytics_customer.id,revenue_agg.customer_id)LEFT JOIN (@@ -3478,12 +3479,13 @@'object_storage_root_password','CSVWithNames','`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_item WHERE and(revenue_item.is_recurring,- isNotNull(revenue_item.subscription_id), ifNull(greaterOrEquals(timestamp, toStartOfMonth(addDays(toDateTime64('2025-05-30 00:00:00.000000',- 6,- 'UTC'), -60))), 0), ifNull(lessOrEquals(timestamp, toDateTime64('2025-05-30 00:00:00.000000',- 6,- 'UTC')), 0))+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status,+ 'paid'), posthog_test_stripe_invoice.paid)) AS invoice) AS revenue_item WHERE and(revenue_item.is_recurring,+ isNotNull(revenue_item.subscription_id), ifNull(greaterOrEquals(timestamp, toStartOfMonth(addDays(toDateTime64('2025-05-30 00:00:00.000000',+ 6,+ 'UTC'), -60))), 0), ifNull(lessOrEquals(timestamp, toDateTime64('2025-05-30 00:00:00.000000',+ 6,+ 'UTC')), 0))GROUP BY revenue_item.source_label,revenue_item.customer_id,revenue_item.subscription_id, timestampdiff --git a/products/revenue_analytics/backend/views/test/__snapshots__/test_mrr_views.ambr b/products/revenue_analytics/backend/views/test/__snapshots__/test_mrr_views.ambrindex 0eadff10489b..8383ba33b2d0 100644--- a/products/revenue_analytics/backend/views/test/__snapshots__/test_mrr_views.ambr+++ b/products/revenue_analytics/backend/views/test/__snapshots__/test_mrr_views.ambr@@ -268,7 +268,7 @@arrayJoin(range(0, period_months)) AS month_index,ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.mrr_views.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice- WHERE posthog_test_stripe_invoice.paid) AS invoice+ WHERE if(isNull(posthog_test_stripe_invoice.paid), equals(posthog_test_stripe_invoice.status, 'paid'), posthog_test_stripe_invoice.paid)) AS invoiceUNION ALL SELECT posthog_test_stripe_charge.id AS id,id AS invoice_item_id,'stripe.posthog_test' AS source_label,diff --git a/products/warehouse_sources/backend/models/external_table_definitions.py b/products/warehouse_sources/backend/models/external_table_definitions.pyindex 7355573dd548..53254c634411 100644--- a/products/warehouse_sources/backend/models/external_table_definitions.py+++ b/products/warehouse_sources/backend/models/external_table_definitions.py@@ -1,3 +1,5 @@+from collections.abc import Collection+from posthog.hogql import astfrom posthog.hogql.database.models import (BooleanDatabaseField,@@ -156,6 +158,8 @@ external_tables: dict[str, dict[str, DatabaseField]] = {"id": StringDatabaseField(name="id"),"tax": IntegerDatabaseField(name="tax"),"paid": BooleanDatabaseField(name="paid"),+ "__paid": BooleanDatabaseField(name="paid", hidden=True),+ "parent": StringJSONDatabaseField(name="parent"),"lines": StringJSONDatabaseField(name="lines"),"total": IntegerDatabaseField(name="total"),"charge": StringDatabaseField(name="charge"),@@ -236,6 +240,7 @@ external_tables: dict[str, dict[str, DatabaseField]] = {name="effective_at",),"subscription_id": StringDatabaseField(name="subscription"),+ "__subscription": StringDatabaseField(name="subscription", hidden=True),"attempt_count": IntegerDatabaseField(name="attempt_count"),"automatic_tax": StringJSONDatabaseField(name="automatic_tax"),"customer_name": StringDatabaseField(name="customer_name"),@@ -660,7 +665,10 @@ external_tables: dict[str, dict[str, DatabaseField]] = {"tax_rates": StringJSONDatabaseField(name="tax_rates"),"test_clock": StringDatabaseField(name="test_clock"),"unit_amount": IntegerDatabaseField(name="unit_amount"),+ "__unit_amount": IntegerDatabaseField(name="unit_amount", hidden=True),"unit_amount_decimal": StringDatabaseField(name="unit_amount_decimal"),+ "__unit_amount_decimal": StringDatabaseField(name="unit_amount_decimal", hidden=True),+ "pricing": StringJSONDatabaseField(name="pricing"),},"stripe_payout": {"id": StringDatabaseField(name="id"),@@ -1471,12 +1479,20 @@ class _SingleFieldChainCollector(TraversingVisitor):"""Collects the single-segment field references (e.g. `__created`) inside an expression."""def __init__(self) -> None:+ super().__init__()self.names: set[str] = set()+ self._bound: set[str] = set()def visit_field(self, node: ast.Field) -> None:- if len(node.chain) == 1 and isinstance(node.chain[0], str):+ if len(node.chain) == 1 and isinstance(node.chain[0], str) and node.chain[0] not in self._bound:self.names.add(node.chain[0])+ def visit_lambda(self, node: ast.Lambda) -> None:+ # A lambda argument shadows any column of the same name inside the body.+ self._bound |= set(node.args)+ self.visit(node.expr)+ self._bound -= set(node.args)+def get_hogql_column_name_mapping(table_name_without_prefix: str) -> dict[str, str]:"""Map each raw synced column name to the HogQL-visible field name it surfaces as.@@ -1519,3 +1535,168 @@ def get_hogql_column_name_mapping(table_name_without_prefix: str) -> dict[str, smapping.setdefault(field.name, key)return mapping+++def _f(name: str) -> ast.Field:+ return ast.Field(chain=[name])+++def _null_if(expr: ast.Expr, empty: str | int) -> ast.Call:+ return ast.Call(name="nullIf", args=[expr, ast.Constant(value=empty)])+++def _prefer_legacy(legacy_key: str, relocated: ast.Expr, empty: str | int | None = None) -> ast.Call:+ """Read the legacy column, falling back to the relocated value only where it holds nothing.++ ClickHouse evaluates every `coalesce` argument for every row, so a coalesce would run the JSON+ extract even on rows whose legacy column is populated. `if` short-circuits.+ """+ legacy = _f(legacy_key)+ missing: ast.Expr = ast.Call(name="isNull", args=[legacy])+ if empty is not None:+ missing = ast.Or(+ exprs=[+ missing,+ ast.CompareOperation(left=legacy, right=ast.Constant(value=empty), op=ast.CompareOperationOp.Eq),+ ]+ )+ return ast.Call(name="if", args=[missing, relocated, legacy])+++def _json_str(column: str, *path: str) -> ast.Call:+ return ast.Call(name="JSONExtractString", args=[_f(column), *[ast.Constant(value=part) for part in path]])+++def _epoch_to_datetime(expr: ast.Expr) -> ast.Call:+ return ast.Call(name="toDateTime", args=[ast.Call(name="toString", args=[expr])])+++def _int_from_each(column: str, path: str, key: str) -> ast.Call:+ """Pull one integer key out of every element of a JSON array column."""+ return ast.Call(+ name="arrayMap",+ args=[+ ast.Lambda(+ args=["x"],+ expr=ast.Call(name="JSONExtractInt", args=[_f("x"), ast.Constant(value=key)]),+ ),+ ast.Call(+ name="JSONExtractArrayRaw",+ # The synced column is nullable and `Array` cannot sit inside `Nullable`.+ args=[+ ast.Call(name="coalesce", args=[_f(column), ast.Constant(value="")]),+ ast.Constant(value=path),+ ],+ ),+ ],+ )+++def _expression(name: str, expr: ast.Expr) -> ast.ExpressionField:+ return ast.ExpressionField(isolate_scope=True, expr=expr, name=name)+++# Stripe's 2025-03-31.basil release moved these fields into new objects, and a table holds the old+# column, the new one, or both, depending on which API version rendered each row — polling is pinned+# while webhook events render at the connected account's own default. Each definition reads the new+# location and falls back to the legacy column so either shape resolves. Keyed by the columns the+# expression needs: a table that has not synced them yet keeps the plain legacy field, because the+# generated s3() structure would otherwise lack a column the field references and fail every query.+_MOVED_COLUMN_FIELDS: dict[str, dict[str, ast.ExpressionField]] = {+ "stripe_invoice": {+ "subscription_id": _expression(+ "subscription_id",+ _prefer_legacy("__subscription", _json_str("parent", "subscription_details", "subscription"), empty=""),+ ),+ "paid": _expression(+ "paid",+ _prefer_legacy(+ "__paid",+ ast.CompareOperation(left=_f("status"), right=ast.Constant(value="paid"), op=ast.CompareOperationOp.Eq),+ ),+ ),+ },+ "stripe_subscription": {+ "current_period_start": _expression(+ "current_period_start",+ _epoch_to_datetime(+ _prefer_legacy(+ "__current_period_start",+ _null_if(+ ast.Call(name="arrayMin", args=[_int_from_each("items", "data", "current_period_start")]), 0+ ),+ empty=0,+ )+ ),+ ),+ "current_period_end": _expression(+ "current_period_end",+ _epoch_to_datetime(+ _prefer_legacy(+ "__current_period_end",+ _null_if(+ ast.Call(name="arrayMax", args=[_int_from_each("items", "data", "current_period_end")]), 0+ ),+ empty=0,+ )+ ),+ ),+ },+ "stripe_invoiceitem": {+ "unit_amount_decimal": _expression(+ "unit_amount_decimal",+ _prefer_legacy("__unit_amount_decimal", _json_str("pricing", "unit_amount_decimal"), empty=""),+ ),+ "unit_amount": _expression(+ "unit_amount",+ _prefer_legacy(+ "__unit_amount",+ ast.Call(name="toInt", args=[_json_str("pricing", "unit_amount_decimal")]),+ ),+ ),+ },+}+++def _referenced_keys(field: ast.ExpressionField) -> set[str]:+ collector = _SingleFieldChainCollector()+ collector.visit(field.expr)+ return collector.names+++def resolve_external_table_fields(+ table_name_without_prefix: str, present_columns: Collection[str]+) -> dict[str, DatabaseField] | None:+ """Curated HogQL fields for a table, adapted to the columns it actually synced.++ Returns `None` for tables with no curated definition. A curated field is dropped when its raw+ column is absent, because the generated s3() structure is built from the synced columns and a+ field pointing outside it fails the whole query rather than just that column.+ """+ fields = external_tables.get(table_name_without_prefix)+ if fields is None:+ return None++ available = set(present_columns)+ dropped = {+ key+ for key, field in fields.items()+ if not isinstance(field, ast.ExpressionField) and field.name not in available+ }+ overrides = _MOVED_COLUMN_FIELDS.get(table_name_without_prefix, {})++ if not dropped:+ return {**fields, **overrides}++ resolved: dict[str, DatabaseField] = {}+ for key, field in fields.items():+ override = overrides.get(key)+ if override is not None and not _referenced_keys(override) & dropped:+ resolved[key] = override+ continue+ if key in dropped:+ continue+ if isinstance(field, ast.ExpressionField) and _referenced_keys(field) & dropped:+ continue+ resolved[key] = field+ return resolveddiff --git a/products/warehouse_sources/backend/models/table.py b/products/warehouse_sources/backend/models/table.pyindex 712bc03eaadb..96a2579e528d 100644--- a/products/warehouse_sources/backend/models/table.py+++ b/products/warehouse_sources/backend/models/table.py@@ -63,7 +63,7 @@ from products.warehouse_sources.backend.temporal.data_imports.pipelines.core.confrom products.warehouse_sources.backend.types import DataWarehouseTableCreatedVia, DataWarehouseTableFormatfrom .credential import DataWarehouseCredential-from .external_table_definitions import external_tables, get_hogql_column_name_mapping+from .external_table_definitions import external_tables, get_hogql_column_name_mapping, resolve_external_table_fieldsif TYPE_CHECKING:from posthog.schema import HogQLQueryModifiers@@ -984,7 +984,7 @@ class DataWarehouseTable(CreatedMetaFields, UpdatedMetaFields, UUIDTModel, Delet)# Replace fields with any redefined fields if they exist- external_table_fields = external_tables.get(self.table_name_without_prefix())+ external_table_fields = resolve_external_table_fields(self.table_name_without_prefix(), columns.keys())default_fields = external_tables.get("*", {})if external_table_fields is not None:fields = {**external_table_fields, **default_fields}diff --git a/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/stripe/conftest.py b/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/stripe/conftest.pyindex d173c64c002e..91f4c494e7e3 100644--- a/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/stripe/conftest.py+++ b/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/stripe/conftest.py@@ -9,6 +9,7 @@ from products.warehouse_sources.backend.temporal.data_imports.tests.e2e.stripe.dCUSTOMER_BALANCE_TRANSACTIONS,CUSTOMERS,DELETED_CUSTOMER_IDS,+ INVOICES,)@@ -68,6 +69,8 @@ class MockStripeAPI:data = BALANCE_TRANSACTIONS # type: ignorecase "customers":data = CUSTOMERS # type: ignore+ case "invoices":+ data = INVOICES # type: ignorecase _:raise ValueError(f"Mock Stripe API: Unknown resource: {resource}")diff --git a/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/stripe/data.py b/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/stripe/data.pyindex cab6d03a65e6..15977c148381 100644--- a/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/stripe/data.py+++ b/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/stripe/data.py@@ -180,3 +180,27 @@ CUSTOMER_BALANCE_TRANSACTIONS: dict[str, list[dict]] = {}DELETED_CUSTOMER_IDS = {"cus_gone"}+++# A newer-shaped invoice. Stripe's 2025-03-31.basil release moved `subscription` into `parent` and+# replaced `paid` with `status`, so an account whose default API version has moved delivers webhook+# payloads without the flat columns the canonical schema reads.+INVOICES = [+ {+ "id": "in_1SampleInvoiceIdAAAA",+ "object": "invoice",+ "created": 1743159813,+ "currency": "usd",+ "customer": "cus_SampleCustomerAAA",+ "status": "paid",+ "amount_paid": 4200,+ "amount_due": 4200,+ "billing_reason": "subscription_cycle",+ "parent": {+ "type": "subscription_details",+ "quote_details": None,+ "subscription_details": {"metadata": {}, "subscription": "sub_1SampleSubscriptionAA"},+ },+ "lines": {"object": "list", "data": [], "has_more": False},+ },+]diff --git a/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/stripe/test_stripe_source.py b/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/stripe/test_stripe_source.pyindex c8cb12e7041c..130c434ed4aa 100644--- a/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/stripe/test_stripe_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/stripe/test_stripe_source.py@@ -14,6 +14,8 @@ from asgiref.sync import sync_to_asyncfrom parameterized import parameterizedfrom stripe._http_client import HTTPClient+from posthog.hogql.query import execute_hogql_query+from posthog.models.integration import Integrationfrom products.warehouse_sources.backend.facade.models import ExternalDataSchema, ExternalDataSource@@ -45,7 +47,7 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.stripe.str)from products.warehouse_sources.backend.temporal.data_imports.tests.e2e.conftest import run_external_data_job_workflow-from .data import BALANCE_TRANSACTIONS, CUSTOMER_BALANCE_TRANSACTIONS, CUSTOMERS+from .data import BALANCE_TRANSACTIONS, CUSTOMER_BALANCE_TRANSACTIONS, CUSTOMERS, INVOICESpytestmark = pytest.mark.usefixtures("minio_client")@@ -85,6 +87,17 @@ def external_data_schema_full_refresh(external_data_source, team):return schema+def external_data_schema_invoice(external_data_source, team):+ return ExternalDataSchema.objects.create(+ name="Invoice",+ team_id=team.pk,+ source_id=external_data_source.pk,+ sync_type="full_refresh",+ sync_type_config={},+ )++@pytest.fixturedef external_data_schema_incremental(external_data_source, team):schema = ExternalDataSchema.objects.create(@@ -1387,3 +1400,25 @@ async def test_a_missing_parent_schema_keeps_the_api_path(team, mock_stripe_api,assert _listing_calls(mock_stripe_api), "with no parent table there is nothing to read but the API"assert sorted(_child_calls(mock_stripe_api)) == PROBED_CUSTOMERS++[email protected]_db(transaction=True)+async def test_invoice_reads_relocated_fields_from_the_newer_payload_shape(+ team, mock_stripe_api, external_data_source, external_data_schema_invoice+):+ # Rows rendered at a newer Stripe version carry `parent` and `status` instead of the flat+ # `subscription` and `paid` columns. Those arrive empty, so the curated fields have to read the+ # new locations or every subscription-billed invoice reads as unlinked and unpaid.+ await run_external_data_job_workflow(+ team=team,+ external_data_source=external_data_source,+ external_data_schema=external_data_schema_invoice,+ table_name="stripe_invoice",+ expected_rows_synced=len(INVOICES),+ expected_total_rows=len(INVOICES),+ )++ res = await sync_to_async(execute_hogql_query)("SELECT subscription_id, paid FROM stripe_invoice", team)++ assert res.results == [("sub_1SampleSubscriptionAA", True)]diff --git a/products/warehouse_sources/backend/tests/test_external_table_definitions.py b/products/warehouse_sources/backend/tests/test_external_table_definitions.pyindex 0a6b7b21579e..7b5def2f245e 100644--- a/products/warehouse_sources/backend/tests/test_external_table_definitions.py+++ b/products/warehouse_sources/backend/tests/test_external_table_definitions.py@@ -1,6 +1,36 @@+from collections.abc import Collection++from posthog.test.base import BaseTest, ClickhouseTestMixin+from parameterized import parameterized-from products.warehouse_sources.backend.models.external_table_definitions import get_hogql_column_name_mapping+from posthog.hogql import ast+from posthog.hogql.database.models import DatabaseField+from posthog.hogql.functions.mapping import find_hogql_function+from posthog.hogql.query import execute_hogql_query+from posthog.hogql.visitor import CloningVisitor, TraversingVisitor++from products.warehouse_sources.backend.models.external_table_definitions import (+ _MOVED_COLUMN_FIELDS,+ _referenced_keys,+ external_tables,+ get_hogql_column_name_mapping,+ resolve_external_table_fields,+)+++def _plain_columns(table: str) -> set[str]:+ return {field.name for field in external_tables[table].values() if not isinstance(field, ast.ExpressionField)}+++def _reads(field: object) -> set[str]:+ return _referenced_keys(field) if isinstance(field, ast.ExpressionField) else set()+++def _resolve(table: str, columns: Collection[str]) -> dict[str, DatabaseField]:+ fields = resolve_external_table_fields(table, columns)+ assert fields is not None+ return fieldsclass TestGetHogqlColumnNameMapping:@@ -35,3 +65,167 @@ class TestGetHogqlColumnNameMapping:def test_unknown_table_returns_empty_mapping(self) -> None:# Arbitrary SQL sources have no curated definition — raw names are exposed unchanged.assert get_hogql_column_name_mapping("some_postgres_table") == {}+++class TestResolveExternalTableFields:+ @parameterized.expand(+ [+ ("stripe_invoice", "subscription_id", "parent"),+ ("stripe_subscription", "current_period_start", "items"),+ ("stripe_subscription", "current_period_end", "items"),+ ("stripe_invoiceitem", "unit_amount", "pricing"),+ ("stripe_invoiceitem", "unit_amount_decimal", "pricing"),+ ]+ )+ def test_reads_the_relocated_column_only_when_the_table_has_it(+ self, table: str, key: str, relocated_into: str+ ) -> None:+ columns = _plain_columns(table)++ assert relocated_into in _reads(_resolve(table, columns)[key])+ # Without the new column the field must stop referencing it. The s3() structure is built+ # from the synced columns, so a field reaching outside it fails every query on the table.+ assert relocated_into not in _reads(_resolve(table, columns - {relocated_into})[key])++ def test_drops_a_curated_field_whose_column_is_missing(self) -> None:+ resolved = _resolve("stripe_invoice", _plain_columns("stripe_invoice") - {"parent"})++ assert "parent" not in resolved+ assert "subscription_id" in resolved++ def test_keeps_every_field_when_all_columns_are_present(self) -> None:+ columns = _plain_columns("stripe_invoice")++ assert set(_resolve("stripe_invoice", columns)) == set(external_tables["stripe_invoice"])++ def test_unknown_table_has_no_curated_fields(self) -> None:+ assert resolve_external_table_fields("some_postgres_table", []) is None+++class _CallNameCollector(TraversingVisitor):+ def __init__(self) -> None:+ super().__init__()+ self.names: set[str] = set()++ def visit_call(self, node: ast.Call) -> None:+ self.names.add(node.name)+ for arg in node.args:+ self.visit(arg)+ for param in node.params or []:+ self.visit(param)+++class TestCuratedExpressionsCallRealFunctions:+ def test_every_expression_uses_a_function_hogql_knows(self) -> None:+ # A ClickHouse-only or misspelled name builds fine in Python and only fails when someone+ # queries the table, so every curated and relocated expression is checked here instead.+ unknown: set[str] = set()+ tables: list[dict[str, object]] = [dict(fields) for fields in external_tables.values()]+ tables += [dict(fields) for fields in _MOVED_COLUMN_FIELDS.values()]++ for fields in tables:+ for field in fields.values():+ if not isinstance(field, ast.ExpressionField):+ continue+ collector = _CallNameCollector()+ collector.visit(field.expr)+ unknown |= {name for name in collector.names if find_hogql_function(name) is None}++ assert unknown == set()+++class _SubstituteColumns(CloningVisitor):+ """Replaces the column references in a curated expression with literal values."""++ def __init__(self, values: dict[str, object]) -> None:+ super().__init__()+ self._values = values++ def visit_field(self, node: ast.Field) -> ast.Expr:+ if len(node.chain) == 1 and node.chain[0] in self._values:+ return ast.Constant(value=self._values[node.chain[0]])+ return super().visit_field(node)+++def _evaluate(table: str, key: str, columns: dict[str, object], team) -> object:+ field = _resolve(table, _plain_columns(table))[key]+ assert isinstance(field, ast.ExpressionField)+ query = ast.SelectQuery(select=[_SubstituteColumns(columns).visit(field.expr)])+ return execute_hogql_query(query, team).results[0][0]+++_PERIOD = 1743159813+++class TestRelocatedFieldsResolveTheSameValue(ClickhouseTestMixin, BaseTest):+ # The resolver tests above only compare column names, so a wrong JSON path, a mishandled empty+ # list or a broken numeric conversion would still pass them. These run the real expression.+ @parameterized.expand(+ [+ ("legacy", {"__subscription": "sub_x", "parent": None}, "sub_x"),+ (+ "relocated",+ {"__subscription": None, "parent": '{"subscription_details":{"subscription":"sub_x"}}'},+ "sub_x",+ ),+ ("neither", {"__subscription": None, "parent": None}, None),+ ]+ )+ def test_invoice_subscription_id(self, _name, columns, expected) -> None:+ assert _evaluate("stripe_invoice", "subscription_id", columns, self.team) == expected++ @parameterized.expand(+ [+ ("legacy wins", {"__paid": False, "status": "paid"}, False),+ ("relocated", {"__paid": None, "status": "paid"}, True),+ ("relocated unpaid", {"__paid": None, "status": "open"}, False),+ ]+ )+ def test_invoice_paid(self, _name, columns, expected) -> None:+ assert _evaluate("stripe_invoice", "paid", columns, self.team) == expected++ @parameterized.expand(+ [+ ("legacy", {"__current_period_start": _PERIOD, "items": None}),+ (+ "relocated",+ {"__current_period_start": None, "items": f'{{"data":[{{"current_period_start":{_PERIOD}}}]}}'},+ ),+ ]+ )+ def test_subscription_period_start(self, _name, columns) -> None:+ # Both shapes describe the same instant, so they have to render identically.+ assert _evaluate("stripe_subscription", "current_period_start", columns, self.team) == _evaluate(+ "stripe_subscription", "current_period_start", {"__current_period_start": _PERIOD, "items": None}, self.team+ )++ def test_subscription_period_start_without_any_item(self) -> None:+ # An empty item list must read as nothing rather than as the epoch.+ assert (+ _evaluate(+ "stripe_subscription",+ "current_period_start",+ {"__current_period_start": None, "items": '{"data":[]}'},+ self.team,+ )+ is None+ )++ @parameterized.expand(+ [+ ("legacy", {"__unit_amount": 1500, "pricing": None}, 1500),+ ("relocated", {"__unit_amount": None, "pricing": '{"unit_amount_decimal":"1500"}'}, 1500),+ ("neither", {"__unit_amount": None, "pricing": None}, None),+ ]+ )+ def test_invoice_item_unit_amount(self, _name, columns, expected) -> None:+ assert _evaluate("stripe_invoiceitem", "unit_amount", columns, self.team) == expected++ @parameterized.expand(+ [+ ("legacy", {"__unit_amount_decimal": "1500", "pricing": None}, "1500"),+ ("relocated", {"__unit_amount_decimal": None, "pricing": '{"unit_amount_decimal":"1500"}'}, "1500"),+ ]+ )+ def test_invoice_item_unit_amount_decimal(self, _name, columns, expected) -> None:+ assert _evaluate("stripe_invoiceitem", "unit_amount_decimal", columns, self.team) == expected