: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 2 missing tables to the Qonto source (#118591)
Tom Owers845ccf8d9e44
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 323a31f3e5e1..a0d7fe360969 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@@ -9840,8 +9840,8 @@ Diffed against: <https://docs.qonto.com/llms.txt>- [ ] `Cards (GET /v2/cards)` — resolve card identifiers in transactions into card holders and card status (high)- [ ] `Cash flow categories (GET /v2/cash_flow_categories)` — resolve transaction cash flow categories and subcategories into readable labels (high)-- [ ] `SEPA beneficiaries (GET /v2/sepa/beneficiaries)` — resolve beneficiary identifiers in existing transfer records (high)-- [ ] `Client invoices (GET /v2/client_invoices)` — analyze receivables, due dates, and invoice payment status (high)+- [x] `SEPA beneficiaries (GET /v2/sepa/beneficiaries)` — resolve beneficiary identifiers in existing transfer records (high)+- [x] `Client invoices (GET /v2/client_invoices)` — analyze receivables, due dates, and invoice payment status (high)- [ ] `Supplier invoices (GET /v2/supplier_invoices)` — analyze payables and documents requiring payment or review (high)- [ ] `Teams (GET /v2/teams)` — group memberships and spending by organizational team (medium)- [ ] `Clients (GET /v2/clients)` — enrich invoice analysis with customer identities and billing details (medium)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/qonto/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/qonto/canonical_descriptions.pyindex 680eb11edd4e..25ebbb7ff5c6 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/qonto/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/qonto/canonical_descriptions.py@@ -56,4 +56,34 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"beneficiary_id": "Identifier of the transfer beneficiary.",},},+ "beneficiaries": {+ "description": "SEPA beneficiaries that the organization can send transfers to.",+ "docs_url": DOCS + "payments-transfers/sepa-transfers/beneficiaries/sepa-beneficiaries/index",+ "columns": {+ "id": "Unique beneficiary identifier.",+ "name": "Name of the beneficiary.",+ "iban": "IBAN of the beneficiary.",+ "bic": "BIC/SWIFT code of the beneficiary's bank.",+ "status": "Beneficiary status: pending, validated, or declined.",+ "trusted": "Whether the beneficiary is trusted.",+ "created_at": "Time when the beneficiary was created.",+ "updated_at": "Time of the last beneficiary update.",+ },+ },+ "client_invoices": {+ "description": "Invoices that the organization issued to its clients, including imported invoices.",+ "docs_url": DOCS + "expense-management/client-quotes-notes/client-invoices/list-client-invoices",+ "columns": {+ "id": "Unique client invoice identifier.",+ "number": "Invoice number.",+ "status": "Invoice status: draft, unpaid, paid, or canceled.",+ "currency": "Invoice currency.",+ "total_amount_cents": "Total invoice amount in the smallest currency unit.",+ "issue_date": "Date when the invoice was issued.",+ "due_date": "Date when the invoice payment is due.",+ "paid_at": "Time when the invoice was paid.",+ "created_at": "Time when the invoice was created.",+ "client": "Client that the invoice is addressed to.",+ },+ },}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/qonto/qonto.py b/products/warehouse_sources/backend/temporal/data_imports/sources/qonto/qonto.pyindex caed8732bf7d..1053416d629a 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/qonto/qonto.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/qonto/qonto.py@@ -75,6 +75,11 @@ def get_resource(name: str, incremental: bool, last_value: str | datetime | Noneif watermark is None:raise ValueError("Invalid Qonto incremental timestamp")params["updated_at_from"] = watermark.isoformat()+ if name == "client_invoices":+ # Ascending creation order keeps earlier pages stable when new invoices arrive during a sync.+ params["sort_by"] = "created_at:asc"+ # Qonto leaves out imported invoices unless the request asks for them.+ params["exclude_imported"] = "false"if name == "transactions":# The account belongs in the path because the framework uses paths to identify resume checkpoints.path += "?bank_account_id={bank_account_id}"diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/qonto/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/qonto/settings.pyindex 45e314967731..9a30ff7712dc 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/qonto/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/qonto/settings.py@@ -6,6 +6,8 @@ ENDPOINTS = {"labels": ("labels", "labels"),"memberships": ("memberships", "memberships"),"transfers": ("sepa/transfers", "transfers"),+ "beneficiaries": ("sepa/beneficiaries", "beneficiaries"),+ "client_invoices": ("client_invoices", "client_invoices"),}INCREMENTAL_FIELDS: dict[str, list[IncrementalField]] = {diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/qonto/tests/test_qonto.py b/products/warehouse_sources/backend/temporal/data_imports/sources/qonto/tests/test_qonto.pyindex f095a4bfc935..04e81bc52fcd 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/qonto/tests/test_qonto.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/qonto/tests/test_qonto.py@@ -20,7 +20,11 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.tes)from products.warehouse_sources.backend.temporal.data_imports.sources.generated_configs.qonto import QontoSourceConfigfrom products.warehouse_sources.backend.temporal.data_imports.sources.qonto.qonto import validate_credentials-from products.warehouse_sources.backend.temporal.data_imports.sources.qonto.settings import AUTH_ERROR, PERMISSION_ERROR+from products.warehouse_sources.backend.temporal.data_imports.sources.qonto.settings import (+ AUTH_ERROR,+ ENDPOINTS,+ PERMISSION_ERROR,+)from products.warehouse_sources.backend.temporal.data_imports.sources.qonto.source import QontoSourceCONFIG = QontoSourceConfig(login="example-company", secret_key="fake-secret")@@ -92,6 +96,36 @@ def test_incremental_filters(assert result.response.sort_mode == "desc"+ ("endpoint", "selector", "expected_query"),+ [+ ("labels", "labels", {"per_page": ("100",)}),+ ("beneficiaries", "beneficiaries", {"per_page": ("100",)}),+ (+ "client_invoices",+ "client_invoices",+ {"per_page": ("100",), "sort_by": ("created_at:asc",), "exclude_imported": ("false",)},+ ),+ ],+)+def test_full_refresh_endpoints_walk_every_page(+ endpoint: str, selector: str, expected_query: dict[str, tuple[str, ...]]+) -> None:+ result = drive(+ endpoint,+ [page(selector, [{"id": "first"}], 1, 2), page(selector, [{"id": "second"}], 2, 2)],+ incremental_field="updated_at",+ db_incremental_field_last_value="2025-01-02T03:04:05Z",+ )++ assert result.raised is None+ assert [row["id"] for row in result.rows] == ["first", "second"]+ assert [request.path for request in result.requests] == [f"/v2/{ENDPOINTS[endpoint][0]}"] * 2+ assert result.params("page") == ["1", "2"]+ for request in result.requests:+ assert {key: value for key, value in request.query.items() if key != "page"} == expected_query++@pytest.mark.parametrize(("status", "schema_name", "expected"),[