: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
feat(data-warehouse): add brex cost centers table (#113202)
Tom Owers5302728f8456
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.mdindex 057adbc8b3f4..65002a080f4e 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md@@ -968,7 +968,7 @@ Note: BreezoMeter is now Google Maps Platform: the connector calls airquality.go## Brex — gaps-Today (17): `budget_programs`, `budgets`, `card_accounts`, `card_transactions`, `cards`, `cash_accounts`, `cash_transactions`, `departments`, `expenses`, `field_values`, `fields`, `locations`, `spend_limits`, `titles`, `transfers`, `users`, `vendors`+Today (18): `budget_programs`, `budgets`, `card_accounts`, `card_transactions`, `cards`, `cash_accounts`, `cash_transactions`, `cost_centers`, `departments`, `expenses`, `field_values`, `fields`, `locations`, `spend_limits`, `titles`, `transfers`, `users`, `vendors`Diffed against: <https://developer.brex.com/llms.txt>@@ -984,6 +984,7 @@ Diffed against: <https://developer.brex.com/llms.txt>- [ ] `GET /v2/accounts/card/primary/statements and GET /v2/accounts/cash/{id}/statements` — period-end statement balances for reconciliation against transactions (medium)- [ ] `GET /v1/linked_accounts (Payments API)` — lookup resolving the external bank accounts transfers move money to and from (medium)- [ ] `GET /v2/legal_entities (Team API)` — lookup for multi-entity companies, needed to split spend by entity (low)+- [x] `GET /v2/cost_centers (Team API)` — lookup resolving the cost_center_id carried on users and expenses (medium)Note: developer.brex.com serves an SPA (the openapi.json URLs return HTML), but the llms.txt index plus the per-API markdown mirrors (e.g. https://developer.brex.com/openapi/team\_api.md) list every operation with its literal path. Brex ships ten APIs — Accounting, Budgets, Expenses, Fields, Onboarding, Payments, Team, Transactions, Travel, Webhooks — and the connector covers pieces of six. The connector now also exposes /v2/accounts/cash as its own table, alongside the fan-out it already drove.diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/brex/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/brex/canonical_descriptions.pyindex d24884f1df7d..58d58418d4e0 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/brex/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/brex/canonical_descriptions.py@@ -120,6 +120,14 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"name": "Name of the title.",},},+ "cost_centers": {+ "description": "A cost center defined in the Brex account. Resolves the cost_center_id carried on users and expenses.",+ "docs_url": "https://developer.brex.com/openapi/team_api/#tag/Cost-Centers/operation/listCostCenters",+ "columns": {+ "id": "Unique identifier of the cost center.",+ "name": "Name of the cost center.",+ },+ },"cards": {"description": "A Brex card issued to a user or vendor, with its spend controls. Resolves the card_id carried on card transactions.","docs_url": "https://developer.brex.com/openapi/team_api/#tag/Cards/operation/listCardsByUserId",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/brex/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/brex/settings.pyindex 105b5a1c334e..181bad98dc4d 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/brex/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/brex/settings.py@@ -135,6 +135,10 @@ BREX_ENDPOINTS: dict[str, BrexEndpointConfig] = {name="titles",path="/v2/titles",),+ "cost_centers": BrexEndpointConfig(+ name="cost_centers",+ path="/v2/cost_centers",+ ),"cards": BrexEndpointConfig(name="cards",path="/v2/cards",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/brex/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/brex/source.pyindex a2ad7f9d93b9..059e67a6742f 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/brex/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/brex/source.py@@ -71,7 +71,7 @@ class BrexSource(ResumableSource[BrexSourceConfig, BrexResumeConfig]):label="Brex",caption="""Enter your Brex API user token to pull your Brex data into the PostHog Data warehouse.-You can create a token in your [Brex dashboard](https://dashboard.brex.com/settings/developer) under Settings → Developer. Grant read access to the data you want to sync: Transactions and Accounts (card and cash transactions, card and cash accounts), Expenses, Team (users, departments, locations, titles, cards), Payments (vendors, transfers), Budgets (budgets, budget programs, spend limits), and Fields (custom fields and their values).+You can create a token in your [Brex dashboard](https://dashboard.brex.com/settings/developer) under Settings → Developer. Grant read access to the data you want to sync: Transactions and Accounts (card and cash transactions, card and cash accounts), Expenses, Team (users, departments, locations, titles, cost centers, cards), Payments (vendors, transfers), Budgets (budgets, budget programs, spend limits), and Fields (custom fields and their values).Note: Brex tokens expire after 90 days without API activity, so a token that hasn't been used recently may need to be regenerated.""",iconPath="/static/services/brex.png",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/brex/tests/test_brex.py b/products/warehouse_sources/backend/temporal/data_imports/sources/brex/tests/test_brex.pyindex 81fc134001b8..3ebe35470bae 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/brex/tests/test_brex.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/brex/tests/test_brex.py@@ -248,6 +248,7 @@ class TestGetRows:"departments","locations","titles",+ "cost_centers","cards","fields","vendors",@@ -628,6 +629,7 @@ class TestPathResolution:[("users", "/v2/users"),("titles", "/v2/titles"),+ ("cost_centers", "/v2/cost_centers"),("cards", "/v2/cards"),("fields", "/v1/fields"),("field_values", "/v1/fields/{field_id}/values"),