-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
🐛 Source Linkedin Ads: fix changing next_page_token stopping criteria #34166
🐛 Source Linkedin Ads: fix changing next_page_token stopping criteria #34166
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Before Merging a Connector Pull RequestWow! What a great pull request you have here! 🎉 To merge this PR, ensure the following has been done/considered for each connector added or updated:
If the checklist is complete, but the CI check is failing,
|
This PR solves related issue #34164 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @FVidalCarneiro the issue you opened made more clear about the proposition you're suggesting. The change will impact in the connector behavior to probably always retrieve the N+1 page (the page doesn't exist) in most cases. What is the API response to that case? Can you confirm it won't return a 404 error?
Meanwhile I requested to the connector team take a look into your change
Thank you @marcosmarxm for your review. Indeed, with the suggested implementation, we will always obtain the N+1 page, where N is the last page of the object. As you can see in the screenshot below, the API responds with an empty page and status code 200: This means the current suggested implementation works. If we wanted to avoid this "useless" call (but required when there is a broken creative, please read initial description of this PR), there is another solution which would be to add the condition Even though the current suggested implementation would work, this last suggestion would also protect the connector against a potential future Linkedin API update, where a non existing page responds with 404 instead of 200 HTTP code. If you (and/or the connector team) give me your approval, I can add this last suggested implementation (bearing in mind that the downside is that it requires more parsing of the response elements). Do you have a preference on one of these two solutions ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @FVidalCarneiro
Thanks for your PR. Let's leave len(parsed_response.get("elements")) < self.records_limit and (parsed_response.get("paging")["start"] + self.records_limit > parsed_response.get("paging")["total"])
as condition for last page. And add comment with link to issue why we need additional check
Following the feedback of the engineering team available here, I have decided to complement the pagination ending condition with a condition that ensures, based on the total record count field, that there are no other pages to request. This will both:
Ready for review @lazebnyi , many thanks ! |
@FVidalCarneiro Can you pull changes from #35046 to your branch? |
I merged your changes to this branch @lazebnyi , thank you. Let me know if it is ok on your end ? |
Hi @lazebnyi , noticed recently there was a little merge conflict to be solved on |
It was merged in #37421 |
What
This pull request aims in changing the criteria used by the airbyte Linkedin Ads source connector for when to stop requesting the Linkedin API for more pages. Currently, the criteria is the following - stop requesting a new page when page size is smaller than maximum allowed records per page. We propose to change this criteria to - stop requesting a new page when page size is equal to zero.
Fixed #34164
How
This is done by modifying the
next_page_token
method in both theLinkedinAdsStream
class and theLinkedInAdsAnalyticsStream
.Recommended reading order
streams.py
🚨 User Impact 🚨
The source connector will behave as previously expected, no breaking changes. Given that an extra API call is made per account, this might slightly impact source connector performance, but this difference is negligible. The version change should therefore only be of type patch, rendering the connector version therefore equal to 0.6.5.
Pre-merge Actions
Expand the relevant checklist and delete the others.
Updating a connector
Community member or Airbyter
Airbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.