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

Need to also emit legacy state for read override connectors when state is not specified #16569

Merged
merged 2 commits into from
Sep 12, 2022

Conversation

brianjlai
Copy link
Contributor

What

When fixing #16566 , I forgot to also emit the legacy format when state isn't specified.

How

Since we may need to conditionally emit the legacy format in more than one place, I refactored the condition into it's own function so it could be reused.

Tested again w/ the following conditions work with the correct state interpretation:

  • No --state specified in the read request: replicate all records, emit final state
  • state file is {}: replicate all records, emit final state
  • state file is[]: replicate all records, emit final state
  • state file contains valid state: emit no records, emit final state

@brianjlai brianjlai requested a review from a team as a code owner September 10, 2022 04:52
@github-actions github-actions bot added the CDK Connector Development Kit label Sep 10, 2022
"""
# vars(self.__class__) checks if the current class directly overrides the read() function
if "read" in vars(self.__class__):
return defaultdict(dict, state_obj)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you share why you call defaultdict with a dict default factory?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great question! Not sure if it actually makes a difference, but the original code before the changes also wrapped it in defaultdict so I wanted to preserve the same functionality. Reference to prior changes:

state = defaultdict(dict, state_obj)

Copy link
Contributor

@evantahler evantahler left a comment

Choose a reason for hiding this comment

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

👍 from me, but deferring to @alafanechere's review

Copy link
Contributor

@alafanechere alafanechere left a comment

Choose a reason for hiding this comment

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

Lgtm!

@brianjlai
Copy link
Contributor Author

brianjlai commented Sep 12, 2022

/publish-cdk dry-run=true

🕑 https://github.com/airbytehq/airbyte/actions/runs/3040611971
https://github.com/airbytehq/airbyte/actions/runs/3040611971

@brianjlai
Copy link
Contributor Author

brianjlai commented Sep 12, 2022

/publish-cdk dry-run=false

🕑 https://github.com/airbytehq/airbyte/actions/runs/3040649162
https://github.com/airbytehq/airbyte/actions/runs/3040649162

@brianjlai brianjlai merged commit 6253406 into master Sep 12, 2022
@brianjlai brianjlai deleted the brian/replace_per_stream_empty_lists branch September 12, 2022 21:45
robbinhan pushed a commit to robbinhan/airbyte that referenced this pull request Sep 29, 2022
jhammarstedt pushed a commit to jhammarstedt/airbyte that referenced this pull request Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CDK Connector Development Kit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants