: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(warehouse_sources): add Personio salary bands and cost centers tables (#90074)
Tom Owers5bf105715e74
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 4ad8b108d359..f0fb6562a087 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@@ -6398,7 +6398,7 @@ Note: Persona's own repo note (products/warehouse_sources/backend/temporal/data_## Personio — **thin**-Today (3): `absence_periods`, `attendance_periods`, `persons`+Today (5): `absence_periods`, `attendance_periods`, `cost_centers`, `persons`, `salary_bands`Diffed against: <https://developer.personio.de/llms.txt>@@ -6406,7 +6406,8 @@ Diffed against: <https://developer.personio.de/llms.txt>- [ ] `GET /v2/absence-types` — lookup resolving the absence type on every absence period already synced (high)- [ ] `GET /v2/compensations` — salary, hourly, bonus and recurring compensation - the payroll dataset (high)- [ ] `GET /v2/org-units` — department/team hierarchy lookup for grouping persons, absences and attendance (high)-- [ ] `GET /v2/cost-centers` — cost center lookup for allocating attendance and compensation to finance dimensions (medium)+- [x] `GET /v2/cost-centers` — cost center lookup for allocating attendance and compensation to finance dimensions (medium)+- [x] `GET /v2/salary-bands` — salary band ranges (min/max/mid, currency) and the workplaces they apply to (medium)- [ ] `GET /v2/legal-entities` — legal entity lookup for multi-entity headcount and payroll splits (medium)- [ ] `GET /v2/jobs` — job/position catalog referenced from employments (medium)- [ ] `GET /v2/compensations/types` — lookup resolving compensation type IDs on compensation rows (medium)@@ -6415,7 +6416,7 @@ Diffed against: <https://developer.personio.de/llms.txt>- [ ] `GET /v2/recruiting/applications/{id}/stage-transitions` — stage transition history - exactly the state-change data needed for time-in-stage metrics (medium)- [ ] `GET /v2/recruiting/candidates` — candidate records joined to applications above (medium)-Note: PERSONIO_ENDPOINTS in products/warehouse_sources/backend/temporal/data_imports/sources/personio/settings.py is a static 3-entry dict (/v2/persons, /v2/absence-periods, /v2/attendance-periods) - no dynamic discovery. The v2 API exposes roughly 20 listable resources, so this is a small fraction, and notably every organizational lookup that would let you group the synced persons and time data (org units, cost centers, legal entities, jobs) is missing. Exact paths confirmed from the individual reference .md pages. Recruiting endpoints are flagged beta by the vendor.+Note: PERSONIO_ENDPOINTS in products/warehouse_sources/backend/temporal/data_imports/sources/personio/settings.py is a static 5-entry dict (/v2/persons, /v2/absence-periods, /v2/attendance-periods, /v2/salary-bands, /v2/cost-centers) - no dynamic discovery. The v2 API exposes roughly 20 listable resources, so this is still a small fraction, and other organizational lookups that would let you group the synced persons and time data (org units, legal entities, jobs) are still missing. Salary bands and cost centers are dimension lookups with no updated_at/created_at field, so they sync full-refresh only. Exact paths confirmed from the individual reference .md pages. Recruiting endpoints are flagged beta by the vendor.## Pexels — gapsdiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/personio/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/personio/canonical_descriptions.pyindex 4aa37e0b2a05..65ad3de61f2e 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/personio/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/personio/canonical_descriptions.py@@ -51,4 +51,24 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"updated_at": "Time at which the attendance period was last updated.",},},+ "salary_bands": {+ "description": "A salary band with its compensation range and the workplaces it applies to.",+ "docs_url": "https://developer.personio.de/reference/listsalarybands",+ "columns": {+ "id": "Unique identifier for the salary band.",+ "min": "Minimum salary of the band, in major currency units.",+ "max": "Maximum salary of the band, in major currency units.",+ "middle": "Midpoint of the band, in major currency units. Null when no midpoint is defined.",+ "currency": "ISO 4217 three-letter currency code of the band.",+ "workplaces": "Workplaces the salary band applies to, each carrying a workplace id.",+ },+ },+ "cost_centers": {+ "description": "A cost center defined in Personio, used to allocate people and time to finance dimensions.",+ "docs_url": "https://developer.personio.de/reference/listcostcenters",+ "columns": {+ "id": "Unique identifier for the cost center.",+ "name": "The name of the cost center.",+ },+ },}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/personio/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/personio/settings.pyindex f2a0c83f905d..995b72086bd8 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/personio/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/personio/settings.py@@ -54,6 +54,18 @@ PERSONIO_ENDPOINTS: dict[str, PersonioEndpointConfig] = {incremental_param="updated_at.gte",incremental_fields=list(_UPDATED_AT_INCREMENTAL_FIELDS),),+ # Salary bands and cost centers are dimension lookups: no updated_at/created_at field, so no+ # server-side timestamp filter and no partition key — full refresh only.+ "salary_bands": PersonioEndpointConfig(+ name="salary_bands",+ path="/v2/salary-bands",+ scope="personio:salary-bands:read",+ ),+ "cost_centers": PersonioEndpointConfig(+ name="cost_centers",+ path="/v2/cost-centers",+ scope="personio:cost-centers:read",+ ),}ENDPOINTS = tuple(PERSONIO_ENDPOINTS.keys())diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/personio/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/personio/source.pyindex 005f5e374c65..0044a50299dd 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/personio/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/personio/source.py@@ -66,7 +66,7 @@ class PersonioSource(ResumableSource[PersonioSourceConfig, PersonioResumeConfig]label="Personio",caption="""Enter your Personio API credentials to pull your Personio HR data into the PostHog Data warehouse.-An admin can create API credentials in Personio under Settings > Integrations > API credentials. Grant the read scopes for the datasets you want to sync (`personio:persons:read`, `personio:absences:read`, `personio:attendances:read`) and whitelist the employee attributes you need — attributes that aren't whitelisted are silently omitted from responses.""",+An admin can create API credentials in Personio under Settings > Integrations > API credentials. Grant the read scopes for the datasets you want to sync (`personio:persons:read`, `personio:absences:read`, `personio:attendances:read`, `personio:salary-bands:read`, `personio:cost-centers:read`) and whitelist the employee attributes you need — attributes that aren't whitelisted are silently omitted from responses.""",iconPath="/static/services/personio.png",docsUrl="https://posthog.com/docs/cdp/sources/personio",releaseStatus=ReleaseStatus.ALPHA,diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/personio/tests/test_personio.py b/products/warehouse_sources/backend/temporal/data_imports/sources/personio/tests/test_personio.pyindex d4be8c213cd2..5a799feeff5d 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/personio/tests/test_personio.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/personio/tests/test_personio.py@@ -273,6 +273,29 @@ class TestGetRows:assert "updated_at.gt" not in snapshots[0]["params"]assert snapshots[0]["params"]["limit"] == 50+ @pytest.mark.parametrize("endpoint", ["salary_bands", "cost_centers"])+ @mock.patch(AUTH_SESSION_PATCH)+ @mock.patch(CLIENT_SESSION_PATCH)+ def test_dimension_endpoint_never_sends_timestamp_filter(self, MockSession, MockAuth, endpoint):+ # salary-bands and cost-centers have no updated_at field, so incremental_param is None. Even+ # if incremental is requested, the request must go out as a full refresh with no timestamp+ # param — sending one the API ignores would silently claim a filtered sync.+ session = MockSession.return_value+ MockAuth.return_value.post.return_value = _token_response()+ snapshots = _wire(session, [_response(_page([]))])++ _rows(+ _source(+ endpoint,+ _make_manager(),+ should_use_incremental_field=True,+ db_incremental_field_last_value=datetime(2024, 1, 2, tzinfo=UTC),+ )+ )++ assert not any(key.startswith("updated_at") for key in snapshots[0]["params"])+ assert snapshots[0]["params"]["limit"] == 100+@mock.patch(AUTH_SESSION_PATCH)@mock.patch(CLIENT_SESSION_PATCH)def test_resumes_from_saved_state(self, MockSession, MockAuth):diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/personio/tests/test_personio_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/personio/tests/test_personio_source.pyindex c625c60ac2a4..46beb447d039 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/personio/tests/test_personio_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/personio/tests/test_personio_source.py@@ -7,7 +7,10 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.resfrom products.warehouse_sources.backend.temporal.data_imports.sources.generated_configs.personio import (PersonioSourceConfig,)-from products.warehouse_sources.backend.temporal.data_imports.sources.personio.settings import ENDPOINTS+from products.warehouse_sources.backend.temporal.data_imports.sources.personio.settings import (+ ENDPOINTS,+ INCREMENTAL_FIELDS,+)from products.warehouse_sources.backend.temporal.data_imports.sources.personio.source import PersonioSource@@ -49,9 +52,14 @@ class TestPersonioSource:schemas = self.source.get_schemas(self.config, self.team_id)assert {schema.name for schema in schemas} == set(ENDPOINTS)- # All shipped endpoints expose a server-side updated_at filter.- assert all(schema.supports_incremental for schema in schemas)- assert all(schema.supports_append for schema in schemas)+ # Incremental support tracks the settings catalog: only endpoints with a server-side+ # updated_at filter expose it. The salary-bands and cost-centers dimension lookups have no+ # timestamp field, so they must stay full-refresh — marking them incremental would emit an+ # updated_at param the API ignores while claiming to have filtered.+ for schema in schemas:+ expected_incremental = schema.name in INCREMENTAL_FIELDS+ assert schema.supports_incremental is expected_incremental+ assert schema.supports_append is expected_incremental@pytest.mark.parametrize("mock_return, expected_valid, expected_message",