-
Notifications
You must be signed in to change notification settings - Fork 174
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
logs warning if deduplication state is large #1877
base: devel
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for dlt-hub-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
cf80f0d
to
aeca74a
Compare
|
||
dedup_count = len(self._cached_state["unique_hashes"]) | ||
DEDUP_WARNING_THRESHOLD = 200 | ||
if dedup_count > DEDUP_WARNING_THRESHOLD: |
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.
this will flood user with messages. please compare the number of hashes before unique_hashes.update(transformer.unique_hashes)
and after to see if threshold is crossed. so you display that only once
if dedup_count > DEDUP_WARNING_THRESHOLD: | ||
logger.warning( | ||
f"There are {dedup_count} records to be deduplicated because" | ||
f" they share the same primary key `{self.primary_key}`." |
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.
we need way better explanation here.
- primary key is not known sometimes, then we hash the content.
- the root cause is not primary key. it is low resolution of cursor column. ie it is on a day. use cursor column name here
logger_spy = mocker.spy(dlt.common.logger, "warning") | ||
p = dlt.pipeline(pipeline_name=uniq_id()) | ||
p.extract(some_data(1)) | ||
logger_spy.assert_any_call( |
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.
make sure it is displayed only once here
Description
As a first step towards resolving this issue: warns if the deduplication state grows over a large count of hashes of the primary key.
Related Issues
#1131