-
Notifications
You must be signed in to change notification settings - Fork 184
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
Add open/closed range arguments for incremental #1991
Changes from all commits
f58c1cb
66edcd1
b9d8dbd
ca07633
674736c
10e0770
76463d5
4388b73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,12 +94,16 @@ def __init__( | |
self.end_value = incremental.end_value | ||
self.row_order: TSortOrder = self.incremental.row_order | ||
self.on_cursor_value_missing = self.incremental.on_cursor_value_missing | ||
self.range_start = self.incremental.range_start | ||
self.range_end = self.incremental.range_end | ||
else: | ||
self.cursor_column = None | ||
self.last_value = None | ||
self.end_value = None | ||
self.row_order = None | ||
self.on_cursor_value_missing = None | ||
self.range_start = None | ||
self.range_end = None | ||
|
||
def _make_query(self) -> SelectAny: | ||
table = self.table | ||
|
@@ -110,11 +114,11 @@ def _make_query(self) -> SelectAny: | |
|
||
# generate where | ||
if last_value_func is max: # Query ordered and filtered according to last_value function | ||
filter_op = operator.ge | ||
filter_op_end = operator.lt | ||
filter_op = operator.ge if self.range_start == "closed" else operator.gt | ||
filter_op_end = operator.lt if self.range_end == "open" else operator.le | ||
elif last_value_func is min: | ||
filter_op = operator.le | ||
filter_op_end = operator.gt | ||
filter_op = operator.le if self.range_start == "closed" else operator.lt | ||
filter_op_end = operator.gt if self.range_end == "open" else operator.ge | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should document this in sql_database docs. we have separate chapter for incremental loading. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrote a section on the sql docs, hope it's clear. |
||
else: # Custom last_value, load everything and let incremental handle filtering | ||
return query # type: ignore[no-any-return] | ||
|
||
|
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.
do not forget docstrings and docs
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.
also add this to
TIncrementalArgs
(so we can define those in REST API)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.
also when start_range is open - disable boundary deduplication. there's no reason to deduplicate. there's no boundary overlap
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.
Added all here