Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

low-code: Add last_page_size and last_record to pagination context #36408

Merged
merged 9 commits into from
Apr 2, 2024

Conversation

girarda
Copy link
Contributor

@girarda girarda commented Mar 22, 2024

What

Add last_page_size and last_record interpolation variables to the cursor pagination strategy as a first step towards closing https://github.com/airbytehq/airbyte-internal-issues/issues/6554.

These two variables are meant to replace last_records, which is now removed from the documented interpolation context. The field should now be considered to be deprecated. It will be deleted in a follow up PR.

@girarda girarda requested a review from a team as a code owner March 22, 2024 23:15
Copy link

vercel bot commented Mar 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
airbyte-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 26, 2024 4:23pm

@octavia-squidington-iii octavia-squidington-iii added the CDK Connector Development Kit label Mar 22, 2024
decoded_response = self.decoder.decode(response)

# The default way that link is presented in requests.Response is a string of various links (last, next, etc). This
# is not indexable or useful for parsing the cursor, so we replace it with the link dictionary from response.links
headers = response.headers
headers: Dict[str, Any] = dict(response.headers)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for mypy

self.config,
response=decoded_response,
headers=headers,
last_records=last_records,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last_records will be removed in a follow up PR

token = self.cursor_value.eval(config=self.config, last_records=last_records, response=decoded_response, headers=headers)
token = self._cursor_value.eval(
config=self.config,
last_records=last_records,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last_records will be removed in a follow up PR

girarda added 2 commits March 25, 2024 21:53
…m:airbytehq/airbyte into alex/replace_last_records_from_paginators
Copy link
Contributor

@brianjlai brianjlai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense to me!

headers["link"] = response.links

if self.stop_condition:
should_stop = self.stop_condition.eval(self.config, response=decoded_response, headers=headers, last_records=last_records)
last_record = last_records[-1] if last_records else None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this would presumably be removed later in favor of an incoming last_record param as per the description?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's right. It'll be passed as a param

@girarda girarda merged commit 4af69fc into master Apr 2, 2024
31 checks passed
@girarda girarda deleted the alex/replace_last_records_from_paginators branch April 2, 2024 17:43
Copy link

sentry-io bot commented Apr 2, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ AttributeError: 'CursorPaginationStrategy' object has no attribute '_stop_condition' /usr/local/lib/python3.9/site-packages/airbyte_... View Issue
  • ‼️ AttributeError: 'CursorPaginationStrategy' object has no attribute '_stop_condition' /usr/local/lib/python3.9/site-packages/airbyte_... View Issue
  • ‼️ jinja2.exceptions.UndefinedError: list object has no element -1 /usr/local/lib/python3.9/site-packages/airbyte_... View Issue
  • ‼️ AttributeError: 'CursorPaginationStrategy' object has no attribute '_stop_condition' /usr/local/lib/python3.9/site-packages/airbyte_... View Issue

Did you find this useful? React with a 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CDK Connector Development Kit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants