Combining two conditions for pagination stop

Summary

How to combine two conditions for pagination stop in API?


Question

<@U04SE163WC8> Is there a way to combine two conditions in a single stop condition for pagination?



This topic has been created from a Slack thread to give it more visibility.
It will be on Read-Only mode here. Click here if you want to access the original thread.

Join the conversation on Slack

["combine-two-conditions", "pagination-stop", "API"]

Hmm, I don’t know enough to give you a confident answer yet. The extracts provided discuss the concept of a stop condition in pagination, but they do not provide specific details on how to combine two conditions in a single stop condition. For more information on pagination and stop conditions, you can refer to the Airbyte documentation on Pagination and Cursor Pagination.

<@U04SE163WC8> I’m trying to use this expression as a stop condition for pagination:

{{response.error.code == 32017 or response.result.summary_info.page > config['pages_to_fetch'] - 1}}

The first part of this expression before ‘or’ works and the second doesn’t. If I delete the first part, the second part works.

Is there any way to combine these parts into a single expression that will work?

A message from http://kapa.ai|kapa.ai

Based on the information provided in the extracts, it seems that you should be able to use logical operators like or to combine conditions in a Jinja expression for a stop condition. However, the extracts do not provide a specific example of using multiple conditions in a stop condition. The issue you’re experiencing might be due to the evaluation of the conditions. If the first condition is met, the second condition might not be evaluated at all due to the or operator. This is a common behavior in many programming languages where the evaluation stops as soon as one of the conditions in an or expression is true. If both conditions need to be evaluated, you might need to restructure your logic or check if there’s a specific way to enforce this in the context of Airbyte’s pagination stop conditions. For more detailed guidance, you might want to refer to the Airbyte documentation on Pagination and Cursor Pagination. If the issue persists, consider reaching out to the Airbyte community or support for more specific assistance.

<@U033JKD3W8G> would you might help here?

<@U033JKD3W8G> Any thoughts on this case?

I’d expect the or condition to work as a logical or.

In this example, I set a the request_parameter to {{ true or false}} and it’s correctly interpreted as true. how did test the two parts independently?

<@U033JKD3W8G> In our case true or false works (first condition is true and second is false), but false or true doesn’t (first condition is false and second is true). Both cases should evaluate to true. I tested two parts independently and they work as expected.

When I switch the order of the conditions, this problem remains. It seems like or takes only the first condition into account and omits the second.