-
Notifications
You must be signed in to change notification settings - Fork 200
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
SQL Database: Support including/excluding NULL cursor values #1946
Conversation
✅ Deploy Preview for dlt-hub-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
looks good! see comments for small improvements
dlt/sources/sql_database/helpers.py
Outdated
@@ -13,6 +13,8 @@ | |||
) | |||
import operator | |||
|
|||
from sqlalchemy import and_, or_ |
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.
could you import via our lib, not directly?
dlt/sources/sql_database/helpers.py
Outdated
@@ -96,9 +100,15 @@ def _make_query(self) -> SelectAny: | |||
return query # type: ignore[no-any-return] | |||
|
|||
if self.last_value is not None: | |||
query = query.where(filter_op(self.cursor_column, self.last_value)) | |||
where_and_clauses = [filter_op(self.cursor_column, self.last_value)] |
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.
queries are OK. should exclude
option be independent from if self.last_value is not None:
? I think so. we could skip NONE also on initial load
091548f
to
dfa300e
Compare
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.
LGTM!
Description
Respect the
on_cursor_value_missing
incremental setting in sqlalchemy source.Generating WHERE clause equvialent to:
I'm not sure if the
exclude
case needs to be handled but thought I'd include explicitly anyway in case any databases interpret>= NULL
differently.Related Issues
Additional Context