: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): support Google Ads API version v25 (#74172)
Tom Owers3b6cf176b607
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/google_ads.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/google_ads.pyindex 0adef058e798..0f8fd6661003 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/google_ads.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/google_ads.py@@ -24,6 +24,9 @@ from google.ads.googleads.v23.services.services.google_ads_service import Googlefrom google.ads.googleads.v24.common import types as ga_common_v24from google.ads.googleads.v24.enums import types as ga_enums_v24from google.ads.googleads.v24.resources import types as ga_resources_v24+from google.ads.googleads.v25.common import types as ga_common_v25+from google.ads.googleads.v25.enums import types as ga_enums_v25+from google.ads.googleads.v25.resources import types as ga_resources_v25from google.api_core import exceptions as google_api_exceptionsfrom google.auth import exceptions as google_auth_exceptionsfrom google.oauth2 import service_account@@ -318,6 +321,7 @@ class GoogleAdsColumn(Column):_PROTO_MODULES_BY_VERSION: dict[str, dict[str, typing.Any]] = {"v23": {"common": ga_common, "enums": ga_enums, "resources": ga_resources},"v24": {"common": ga_common_v24, "enums": ga_enums_v24, "resources": ga_resources_v24},+ "v25": {"common": ga_common_v25, "enums": ga_enums_v25, "resources": ga_resources_v25},}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/source.pyindex ba8134e5bd4a..dae547ccb381 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/source.py@@ -34,6 +34,7 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.basMARKETING_ANALYTICS_SUGGESTED_TABLE_TOOLTIP,FieldType,ResumableSource,+ VersionDeprecation,)from products.warehouse_sources.backend.temporal.data_imports.sources.common.canonical_descriptions import (CanonicalDescriptions,@@ -82,9 +83,14 @@ def _oauth_accounts_cache_key(team_id: int, integration_id: int) -> str:class GoogleAdsSource(ResumableSource[GoogleAdsSourceConfig | GoogleAdsServiceAccountSourceConfig, GoogleAdsResumeConfig], OAuthMixin):- supported_versions = ("v23", "v24")- default_version = "v24"+ supported_versions = ("v23", "v24", "v25")+ default_version = "v25"api_docs_url = "https://developers.google.com/google-ads/api/docs/release-notes"+ # Google sunsets each major ~12 months after release; v24 (released 2026-04-22) is projected+ # for ~May 2027 but has no firm date on the sunset page yet, so `sunset_at` stays None until+ # Google publishes one. Existing v24 pins stay on v24 until then — Google still serves it, and+ # the repin belongs in the PR that records the real sunset date.+ deprecated_versions = (VersionDeprecation(version="v24", sunset_at=None),)@propertydef source_type(self) -> ExternalDataSourceType:diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/tests/test_google_ads_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/tests/test_google_ads_source.pyindex b48460ce3df3..ad5152eae15f 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/tests/test_google_ads_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/tests/test_google_ads_source.py@@ -1336,27 +1336,38 @@ _GOOGLE_ADS_MODULE = "products.warehouse_sources.backend.temporal.data_imports.sclass TestVersionDeclaration:- def test_v24_is_default_and_both_versions_supported(self):+ def test_v25_is_default_and_all_versions_supported(self):source = GoogleAdsSource()- assert source.default_version == "v24"- assert set(source.supported_versions) == {"v23", "v24"}+ assert source.default_version == "v25"+ assert set(source.supported_versions) == {"v23", "v24", "v25"}++ def test_v24_deprecated_default_is_not(self):+ # v24 is the version the vendor is retiring, so it must carry the deprecation flag that drives+ # the in-product warning; the current default (v25) must never be deprecated.+ source = GoogleAdsSource()+ v24_deprecation = source.get_version_deprecation("v24")+ assert v24_deprecation is not None+ assert v24_deprecation.sunset_at is None+ assert source.get_version_deprecation("v25") is None+ # A NULL pin resolves to the default (v25), so it must not report as deprecated.+ assert source.get_version_deprecation(None) is None@pytest.mark.parametrize("pin, expected",- [("v23", "v23"), ("v24", "v24"), (None, "v24"), ("", "v24")],+ [("v23", "v23"), ("v24", "v24"), ("v25", "v25"), (None, "v25"), ("", "v25")],)- def test_resolve_api_version_honors_pin_and_defaults_to_v24(self, pin, expected):- # A present pin is honored verbatim so an existing v23 source is never silently moved; an- # empty/missing pin falls back to the new v24 default that new sources are stamped with.+ def test_resolve_api_version_honors_pin_and_defaults_to_v25(self, pin, expected):+ # A present pin is honored verbatim so an existing v23/v24 source is never silently moved; an+ # empty/missing pin falls back to the new v25 default that new sources are stamped with.assert GoogleAdsSource().resolve_api_version(pin) == expectedclass TestApiVersionDispatch:- @pytest.mark.parametrize("api_version", ["v23", "v24"])+ @pytest.mark.parametrize("api_version", ["v23", "v24", "v25"])def test_search_service_built_for_resolved_version(self, api_version):# The resolved pin must reach GoogleAdsService.get_service so each source syncs against the# version it is pinned to — the SDK's default flipped to the newest version, so an unpinned- # call would silently move v23 sources to v24.+ # call would silently move older sources to v25.client = mock.Mock()table = _single_row_table()assert table.alias is not None@@ -1377,7 +1388,7 @@ class TestApiVersionDispatch:client.get_service.assert_called_once_with("GoogleAdsService", version=api_version, interceptors=mock.ANY)- @pytest.mark.parametrize("api_version", ["v23", "v24"])+ @pytest.mark.parametrize("api_version", ["v23", "v24", "v25"])def test_field_service_built_for_resolved_version(self, api_version):# Schema discovery must also target the resolved version — before the SDK bump it relied on# the client default being v23, which the bump changed to the newest version.@@ -1400,10 +1411,10 @@ class TestApiVersionDispatch:[(False, "CustomerService"), (True, "GoogleAdsService")],ids=["direct_account_probe", "mcc_account_probe"],)- @pytest.mark.parametrize("pin, expected", [("v23", "v23"), (None, "v24")])+ @pytest.mark.parametrize("pin, expected", [("v23", "v23"), ("v24", "v24"), (None, "v25")])def test_validate_credentials_probes_are_pinned(self, is_mcc, service_name, pin, expected):# Unpinned probes fall through to the SDK's newest bundled version, so a v23 source would- # be validated against v24 and pass (or fail) on a version it never syncs with.+ # be validated against v25 and pass (or fail) on a version it never syncs with.client = mock.Mock()config = GoogleAdsSourceConfig(customer_id="1234567890",@@ -1419,10 +1430,10 @@ class TestApiVersionDispatch:class TestDiscoveryVersionThreading:_SCHEMAS_PATH = "products.warehouse_sources.backend.temporal.data_imports.sources.google_ads.google_ads.get_schemas"- @pytest.mark.parametrize("pin, expected", [("v23", "v23"), ("v24", "v24"), (None, "v24")])+ @pytest.mark.parametrize("pin, expected", [("v23", "v23"), ("v24", "v24"), ("v25", "v25"), (None, "v25")])def test_get_schemas_discovers_against_resolved_pin(self, pin, expected):# Discovery must reconcile against the source's pinned version, not always the default —- # a v23-pinned source must not discover schemas under the newer default (v24).+ # a v23-pinned source must not discover schemas under the newer default (v25).config = GoogleAdsSourceConfig(customer_id="1234567890", google_ads_integration_id=1)with mock.patch(self._SCHEMAS_PATH, return_value={}) as mock_get_schemas:GoogleAdsSource().get_schemas(config, team_id=1, api_version=pin)@@ -1431,10 +1442,10 @@ class TestDiscoveryVersionThreading:class TestTypeUrlVersionResolution:- @pytest.mark.parametrize("api_version", ["v23", "v24"])+ @pytest.mark.parametrize("api_version", ["v23", "v24", "v25"])def test_resolves_enum_type_url_against_matching_version(self, api_version):# Response type URLs carry the API version they were produced under, so the resolver must- # decode a v23 and a v24 response each against its own protos.+ # decode a v23, v24 and v25 response each against its own protos.enum_cls = _resolve_protobuf_message_type_url(f"google.ads.googleads.{api_version}.enums.DeviceEnum")assert enum_cls.__module__.startswith(f"google.ads.googleads.{api_version}.")diff --git a/pyproject.toml b/pyproject.tomlindex 86783a8ee56e..0154fe209199 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -58,7 +58,7 @@ dependencies = ["drf-extensions~=0.8.0","drf-spectacular~=0.29.0","geoip2==4.6.0",- "google-ads==30.1.0",+ "google-ads==31.2.0","google-cloud-bigquery==3.26","google-cloud-bigquery-storage==2.32.0","google-cloud-iam==2.21",@@ -293,7 +293,7 @@ hogql-parser-parity = [required-version = ">=0.10.2"add-bounds = "major"exclude-newer = "7 days"-exclude-newer-package = { hogql-parser = false, hogql-parser-rs = false, posthoganalytics = false, pixelhog = false, django = false, modal = false, posthog-hogland = false }+exclude-newer-package = { hogql-parser = false, hogql-parser-rs = false, posthoganalytics = false, pixelhog = false, django = false, modal = false, posthog-hogland = false, google-ads = false }[tool.uv.workspace]members = ["tools/hogli", "tools/owners"]diff --git a/uv.lock b/uv.lockindex 27346af5e9bc..46d32c553a53 100644--- a/uv.lock+++ b/uv.lock@@ -15,13 +15,14 @@ exclude-newer = "0001-01-01T00:00:00Z" # This has no effect and is included forexclude-newer-span = "P7D"[options.exclude-newer-package]-hogql-parser-rs = falsepixelhog = false-hogql-parser = false+modal = falseposthoganalytics = falsedjango = false+google-ads = false+hogql-parser = falseposthog-hogland = false-modal = false+hogql-parser-rs = false[manifest]members = [@@ -2590,7 +2591,7 @@ wheels = [[[package]]name = "google-ads"-version = "30.1.0"+version = "31.2.0"source = { registry = "https://pypi.org/simple" }dependencies = [{ name = "google-api-core" },@@ -2602,9 +2603,9 @@ dependencies = [{ name = "protobuf" },{ name = "pyyaml" },]-sdist = { url = "https://files.pythonhosted.org/packages/f0/e0/7660c28100d5ef82d8e7348e2f38938c89547d80cd2984692cf7fcf2ee85/google_ads-30.1.0.tar.gz", hash = "sha256:beecd95690cbb5fff728d5455f67588f0af12aec1fb3c54ad373a5a57716e9f4", size = 12140520, upload-time = "2026-04-22T20:55:22.984Z" }+sdist = { url = "https://files.pythonhosted.org/packages/6d/c9/2d9a9f167ae4affb9799a562e295612a6c32c01651d372ac5c027a1a2dce/google_ads-31.2.0.tar.gz", hash = "sha256:7099181c1a7f627739b5c69cf86472bab462fccb743ec7659e252fb87fa1a7da", size = 12446661, upload-time = "2026-07-22T20:46:22.777Z" }wheels = [- { url = "https://files.pythonhosted.org/packages/2e/c6/d198458fb6fa09492f0ef066fcd64ab1f2e5188b369bcba278b4a686eb24/google_ads-30.1.0-py3-none-any.whl", hash = "sha256:ed58ecf23511009664a5628f6d615365459585d55d889a4ba5e98ee652fbef1b", size = 23076755, upload-time = "2026-04-22T20:55:18.936Z" },+ { url = "https://files.pythonhosted.org/packages/3f/53/8ab880a552cd584a01ece34bcf2a9a5333c3d557d447464cc677da06e693/google_ads-31.2.0-py3-none-any.whl", hash = "sha256:80e3c57e54c561f6b24c02988e7fa981b50b00a0a1d85e4596702d3398cf1cff", size = 23673871, upload-time = "2026-07-22T20:46:18.872Z" },][[package]]@@ -4645,7 +4646,7 @@ name = "nvidia-cudnn-cu12"version = "9.10.2.21"source = { registry = "https://pypi.org/simple" }dependencies = [- { name = "nvidia-cublas-cu12" },+ { name = "nvidia-cublas-cu12", marker = "platform_machine != 's390x' and sys_platform != 'emscripten'" },]wheels = [{ url = "https://files.pythonhosted.org/packages/ba/51/e123d997aa098c61d029f76663dedbfb9bc8dcf8c60cbd6adbe42f76d049/nvidia_cudnn_cu12-9.10.2.21-py3-none-manylinux_2_27_x86_64.whl", hash = "sha256:949452be657fa16687d0930933f032835951ef0892b37d2d53824d1a84dc97a8", size = 706758467, upload-time = "2025-06-06T21:54:08.597Z" },@@ -4656,7 +4657,7 @@ name = "nvidia-cufft-cu12"version = "11.3.3.83"source = { registry = "https://pypi.org/simple" }dependencies = [- { name = "nvidia-nvjitlink-cu12" },+ { name = "nvidia-nvjitlink-cu12", marker = "platform_machine != 's390x' and sys_platform != 'emscripten'" },]wheels = [{ url = "https://files.pythonhosted.org/packages/1f/13/ee4e00f30e676b66ae65b4f08cb5bcbb8392c03f54f2d5413ea99a5d1c80/nvidia_cufft_cu12-11.3.3.83-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:4d2dd21ec0b88cf61b62e6b43564355e5222e4a3fb394cac0db101f2dd0d4f74", size = 193118695, upload-time = "2025-03-07T01:45:27.821Z" },@@ -4683,9 +4684,9 @@ name = "nvidia-cusolver-cu12"version = "11.7.3.90"source = { registry = "https://pypi.org/simple" }dependencies = [- { name = "nvidia-cublas-cu12" },- { name = "nvidia-cusparse-cu12" },- { name = "nvidia-nvjitlink-cu12" },+ { name = "nvidia-cublas-cu12", marker = "platform_machine != 's390x' and sys_platform != 'emscripten'" },+ { name = "nvidia-cusparse-cu12", marker = "platform_machine != 's390x' and sys_platform != 'emscripten'" },+ { name = "nvidia-nvjitlink-cu12", marker = "platform_machine != 's390x' and sys_platform != 'emscripten'" },]wheels = [{ url = "https://files.pythonhosted.org/packages/85/48/9a13d2975803e8cf2777d5ed57b87a0b6ca2cc795f9a4f59796a910bfb80/nvidia_cusolver_cu12-11.7.3.90-py3-none-manylinux_2_27_x86_64.whl", hash = "sha256:4376c11ad263152bd50ea295c05370360776f8c3427b30991df774f9fb26c450", size = 267506905, upload-time = "2025-03-07T01:47:16.273Z" },@@ -4696,7 +4697,7 @@ name = "nvidia-cusparse-cu12"version = "12.5.8.93"source = { registry = "https://pypi.org/simple" }dependencies = [- { name = "nvidia-nvjitlink-cu12" },+ { name = "nvidia-nvjitlink-cu12", marker = "platform_machine != 's390x' and sys_platform != 'emscripten'" },]wheels = [{ url = "https://files.pythonhosted.org/packages/c2/f5/e1854cb2f2bcd4280c44736c93550cc300ff4b8c95ebe370d0aa7d2b473d/nvidia_cusparse_cu12-12.5.8.93-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:1ec05d76bbbd8b61b06a80e1eaf8cf4959c3d4ce8e711b65ebd0443bb0ebb13b", size = 288216466, upload-time = "2025-03-07T01:48:13.779Z" },@@ -5355,7 +5356,7 @@ name = "pexpect"version = "4.9.0"source = { registry = "https://pypi.org/simple" }dependencies = [- { name = "ptyprocess" },+ { name = "ptyprocess", marker = "sys_platform != 'emscripten'" },]sdist = { url = "https://files.pythonhosted.org/packages/42/92/cc564bf6381ff43ce1f4d06852fc19a2f11d180f23dc32d9588bee2f149d/pexpect-4.9.0.tar.gz", hash = "sha256:ee7d41123f3c9911050ea2c2dac107568dc43b2d3b0c7557a33212c398ead30f", size = 166450, upload-time = "2023-11-25T09:07:26.339Z" }wheels = [@@ -5873,7 +5874,7 @@ requires-dist = [{ name = "geoip2", specifier = "==4.6.0" },{ name = "gitpython", specifier = "~=3.1.44" },{ name = "glom", specifier = "~=24.11.0" },- { name = "google-ads", specifier = "==30.1.0" },+ { name = "google-ads", specifier = "==31.2.0" },{ name = "google-cloud-bigquery", specifier = "==3.26" },{ name = "google-cloud-bigquery-storage", specifier = "==2.32.0" },{ name = "google-cloud-iam", specifier = "==2.21" },@@ -7624,7 +7625,7 @@ name = "shadowcopy"version = "0.0.4"source = { registry = "https://pypi.org/simple" }dependencies = [- { name = "wmi" },+ { name = "wmi", marker = "sys_platform != 'emscripten'" },]sdist = { url = "https://files.pythonhosted.org/packages/12/44/c00420a3b7bcdf830529b933392b566c876a4944a24f31e126eb6fd28647/shadowcopy-0.0.4.tar.gz", hash = "sha256:ed89817dda065f893607a04c0b7d6b3b34c3507a4711f441111a4bcb1b1826c0", size = 4138, upload-time = "2023-07-08T00:01:35.266Z" }wheels = [@@ -8058,7 +8059,7 @@ name = "tbb"version = "2022.3.1"source = { registry = "https://pypi.org/simple" }dependencies = [- { name = "tcmlib" },+ { name = "tcmlib", marker = "platform_machine != 's390x' and sys_platform != 'emscripten'" },]wheels = [{ url = "https://files.pythonhosted.org/packages/08/59/8d381a2cfe8d36c4f4ff9f94769ff2809bfc16014d888360b0e24c7e5c6b/tbb-2022.3.1-py2.py3-none-manylinux_2_28_x86_64.whl", hash = "sha256:534c089eca6bcf148408684c156229d5f09c01d323b685b15739f41985b529d7", size = 4178630, upload-time = "2026-01-22T05:30:20.589Z" },@@ -8440,7 +8441,7 @@ name = "triton"version = "3.4.0"source = { registry = "https://pypi.org/simple" }dependencies = [- { name = "setuptools" },+ { name = "setuptools", marker = "platform_machine != 's390x' and sys_platform != 'emscripten'" },]wheels = [{ url = "https://files.pythonhosted.org/packages/30/7b/0a685684ed5322d2af0bddefed7906674f67974aa88b0fae6e82e3b766f6/triton-3.4.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:00be2964616f4c619193cb0d1b29a99bd4b001d7dc333816073f92cf2a8ccdeb", size = 155569223, upload-time = "2025-07-30T19:58:44.017Z" },@@ -9147,7 +9148,7 @@ name = "wmi"version = "1.5.1"source = { registry = "https://pypi.org/simple" }dependencies = [- { name = "pywin32" },+ { name = "pywin32", marker = "sys_platform != 'emscripten'" },]sdist = { url = "https://files.pythonhosted.org/packages/d4/66/6364deb0a03415f96c66803d8c4379f808f2401da3bdb183348487b10510/WMI-1.5.1.tar.gz", hash = "sha256:b6a6be5711b1b6c8d55bda7a8befd75c48c12b770b9d227d31c1737dbf0d40a6", size = 26254, upload-time = "2020-04-28T08:22:58.096Z" }wheels = [