Matatika / tap-googleads

0 stars 11 forks source link

Bump version to v14 due to sunset of v12 on 27 Sep #13

Closed dimoobraznii1986 closed 10 months ago

dimoobraznii1986 commented 10 months ago

Description

According to the https://developers.google.com/google-ads/api/docs/sunset-dates the current v12 API will sunset on 27 of September.

I propose the change that bumps v12 to v14.

ReubenFrankel commented 10 months ago

Hi @dimoobraznii1986, unfortunately I can't merge this right away as I am getting this error (looks unrelated to your change):

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/tap_base.py", line 506, in cli
    tap.sync_all()
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/tap_base.py", line 379, in sync_all
    stream.sync()
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/streams/core.py", line 1088, in sync
    for _ in self._sync_records(context=context):
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/streams/core.py", line 998, in _sync_records
    partition_context=state_partition_context,
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/streams/core.py", line 943, in _process_record
    self._sync_children(child_context)
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/streams/core.py", line 1094, in _sync_children
    child_stream.sync(context=child_context)
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/streams/core.py", line 1088, in sync
    for _ in self._sync_records(context=context):
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/streams/core.py", line 988, in _sync_records
    for record_result in self.get_records(current_context):
  File "/home/reuben/Documents/taps/tap-googleads/tap_googleads/streams.py", line 104, in get_records
    for row in self.request_records(context):
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/streams/rest.py", line 355, in request_records
    next_page_token=paginator.current_value,
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/streams/rest.py", line 332, in prepare_request
    json=request_data,
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/streams/rest.py", line 299, in build_prepared_request
    authenticator.authenticate_request(request)
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/authenticators.py", line 106, in authenticate_request
    request.headers.update(self.auth_headers)
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/authenticators.py", line 331, in auth_headers
    if not self.is_token_valid():
  File "/home/reuben/Documents/taps/tap-googleads/tap_googleads/auth.py", line 54, in is_token_valid
    if self.expires_in > (datetime.now() - self.last_refreshed).total_seconds():
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/pendulum/datetime.py", line 1437, in __rsub__
    return self.diff(other, False)
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/pendulum/datetime.py", line 794, in diff
    return Period(self, dt, absolute=abs)
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/pendulum/period.py", line 33, in __new__
    raise TypeError("can't compare offset-naive and offset-aware datetimes")
TypeError: can't compare offset-naive and offset-aware datetimes

I will look into getting it working now - probably will end up as a minor version bump (i.e. v0.5.0).

ReubenFrankel commented 10 months ago

Ok, this error does look related:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/tap_base.py", line 506, in cli
    tap.sync_all()
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/tap_base.py", line 379, in sync_all
    stream.sync()
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/streams/core.py", line 1088, in sync
    for _ in self._sync_records(context=context):
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/streams/core.py", line 998, in _sync_records
    partition_context=state_partition_context,
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/streams/core.py", line 943, in _process_record
    self._sync_children(child_context)
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/streams/core.py", line 1094, in _sync_children
    child_stream.sync(context=child_context)
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/streams/core.py", line 1088, in sync
    for _ in self._sync_records(context=context):
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/streams/core.py", line 998, in _sync_records
    partition_context=state_partition_context,
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/streams/core.py", line 943, in _process_record
    self._sync_children(child_context)
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/streams/core.py", line 1094, in _sync_children
    child_stream.sync(context=child_context)
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/streams/core.py", line 1088, in sync
    for _ in self._sync_records(context=context):
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/streams/core.py", line 988, in _sync_records
    for record_result in self.get_records(current_context):
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/streams/rest.py", line 537, in get_records
    for record in self.request_records(context):
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/streams/rest.py", line 357, in request_records
    resp = decorated_request(prepared_request, context)
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/backoff/_sync.py", line 105, in retry
    ret = target(*args, **kwargs)
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/streams/rest.py", line 253, in _request
    self.validate_response(response)
  File "/home/reuben/.cache/pypoetry/virtualenvs/tap-googleads-hv6xsM63-py3.7/lib/python3.7/site-packages/singer_sdk/streams/rest.py", line 181, in validate_response
    raise FatalAPIError(msg)
singer_sdk.exceptions.FatalAPIError: 400 Client Error: Bad Request for path: /v14/customers/2030837398/googleAds:search
ReubenFrankel commented 10 months ago

Issue was v12/common/explorer_auto_optimizer_setting.proto removed in v13.

{
  "error": {
    "code": 400,
    "message": "Request contains an invalid argument.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.ads.googleads.v14.errors.GoogleAdsFailure",
        "errors": [
          {
            "errorCode": {
              "queryError": "UNRECOGNIZED_FIELD"
            },
            "message": "Unrecognized field in the query: 'ad_group.explorer_auto_optimizer_setting.opt_in'."
          }
        ],
        "requestId": "nOmGuuKfY5o1iAYJwrh3qA"
      }
    ]
  }
}
ReubenFrankel commented 10 months ago

Thanks for the PR @dimoobraznii1986! :slightly_smiling_face:

ReubenFrankel commented 10 months ago

Quick note: we never had v0.4.0 released, so I've reverted back so can do a release for that version.

https://github.com/Matatika/tap-googleads/commit/aa132aa1fb67d1b60341934e9d9d26b7ce5c0c13 https://github.com/Matatika/tap-googleads/commit/c6eff87a784111e4fdda6abbe0a2db5e43b2e6ad