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

add read only fields to memory, clean record #23

Merged
merged 2 commits into from
Sep 17, 2024
Merged

add read only fields to memory, clean record #23

merged 2 commits into from
Sep 17, 2024

Conversation

keyn4
Copy link
Contributor

@keyn4 keyn4 commented Sep 10, 2024

No description provided.

Copy link
Contributor

@butkeraites-hotglue butkeraites-hotglue left a comment

Choose a reason for hiding this comment

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

Hey @keyn4 ! Great job! I think we should just add a protection layer for the json.loads but it LGTM :)

@@ -1010,6 +1014,12 @@ def upsert_record(self, record, context):
if "INVALID_FIELD_FOR_INSERT_UPDATE" in str(e):
fields = json.loads(str(e))[0]['fields']
Copy link
Contributor

Choose a reason for hiding this comment

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

This is too generic in my point of view... If the Exception that arises from the try block is not JSON serializable it will raise a json.JSONDecodeError. Should we put this section in a try-except block to handle it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added!

Comment on lines 1018 to 1021
if not self._target.read_only_fields.get(self.stream_name):
self._target.read_only_fields[self.stream_name] = fields
else:
self._target.read_only_fields[self.stream_name].extend(fields)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if not self._target.read_only_fields.get(self.stream_name):
self._target.read_only_fields[self.stream_name] = fields
else:
self._target.read_only_fields[self.stream_name].extend(fields)
if not self._target.read_only_fields.get(self.stream_name):
self._target.read_only_fields[self.stream_name] = {}
self._target.read_only_fields[self.stream_name].extend(fields)

Copy link
Contributor

@butkeraites-hotglue butkeraites-hotglue left a comment

Choose a reason for hiding this comment

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

Great job!

@hsyyid hsyyid merged commit 9a56fcb into main Sep 17, 2024
0 of 5 checks passed
@hsyyid hsyyid deleted the HGI-6458 branch September 17, 2024 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants