Skip to content
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

fix(Workable): use append write disposition for candidate subresources #366

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sources/workable/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ def _get_details(
# A transformer functions that yield the activities and offers for each candidate.
for sub_endpoint in DEFAULT_DETAILS["candidates"]:
logging.info(
f"Loading additional data for 'candidates' from '{sub_endpoint}' in 'merge' mode."
f"Loading additional data for 'candidates' from '{sub_endpoint}' in 'append' mode."
)
yield candidates_resource | dlt.transformer(
name=f"candidates_{sub_endpoint}", write_disposition="merge"
name=f"candidates_{sub_endpoint}", write_disposition="append"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey! you are right, we missed primary_key (or merge_key) here, candidates details response has no id key to make it primary. I think it makes more sense to set write_disposition='replace', to avoid data duplication.

Copy link
Contributor Author

@ethanve ethanve Mar 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AstrakhantsevaAA given that candidates is incremental, it will replace all existing data with just updated ones.
So for example,

  1. Initial sync syncs 100 candidates and 10 offers
  2. Candidate 20 now has an offer
  3. Second pull will replace candidate offers with only a single offer for candidate 20

While merge may have duplicates, it's better than the alternative of replacing everything

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right!

)(_get_details)("candidates", sub_endpoint, "id")
Loading