Skip to content

Commit

Permalink
make kwargs.next_page_token.next_page_token available in self.config.…
Browse files Browse the repository at this point in the history
…next_page_token to solve airbytehq/airbyte#40697 for now
  • Loading branch information
ossmht authored Dec 5, 2024
1 parent fa505de commit 29dbcf7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions airbyte/caches/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,30 @@

from __future__ import annotations

############## HACKS ################
#
## HACK
# put kwargs.next_page_token.next_page_token into self.config.next_page_token. read more in comments below/
#

from airbyte_cdk.sources.declarative.requesters.request_options.interpolated_nested_request_input_provider import InterpolatedNestedRequestInputProvider
def hacked_eval_request_inputs(self, stream_state, stream_slice, next_page_token) :
kwargs = {
"stream_state": stream_state,
"stream_slice": stream_slice,
"next_page_token": next_page_token,
}
##
# HACK is this: put kwargs.next_page_token.next_page_token into self.config.next_page_token, so it can be referenced as config.next_page_token
# this solves: https://github.com/airbytehq/airbyte/issues/40697 for now
##
self.config['next_page_token'] = kwargs.get('next_page_token').get('next_page_token') if kwargs.get('next_page_token') else None
return self._interpolator.eval(self.config, **kwargs)

InterpolatedNestedRequestInputProvider.eval_request_inputs = hacked_eval_request_inputs

## end of HACK

from airbyte.caches import base, bigquery, duckdb, motherduck, postgres, snowflake, util
from airbyte.caches.base import CacheBase
from airbyte.caches.bigquery import BigQueryCache
Expand Down

0 comments on commit 29dbcf7

Please sign in to comment.