-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Source ZohoCRM: Update api version and default optional fields to None #27423
Conversation
Before Merging a Connector Pull RequestWow! What a great pull request you have here! 🎉 To merge this PR, ensure the following has been done/considered for each connector added or updated:
If the checklist is complete, but the CI check is failing,
|
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.
Thanks for updating the api and cleaning up the code:
Can you bump the version in the metadata.yaml file?
Can you add a changelog entry to zohocrm.md in the docs directory?
…st params, remove header for modified since param
e617a36
to
7aa6e39
Compare
Yup bumped the version and added a changelog entry |
@richardlam-quotapath, apologies for the delay with merging this. Currently, this connector is not passing our integration tests due to some api regressions and other errors: https://connectors.airbyte.com/files/generated_reports/test_summary/source-zoho-crm/index.html We need to fix these issues first before merging. |
Ah I see, it's not passing an acceptance test. I could take a look at the cause |
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.
Sorry the delay to return to you @richardlam-quotapath I left some comments. Let me know if there anything else I can do to help you. When you fix them we can merge your contribution.
fields = ",".join([field.api_name for field in self.module.fields][0:50]) # Note, limited to 50 fields at max | ||
return f"/crm/v4/{self.module.api_name}?fields={fields}" |
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.
fields = ",".join([field.api_name for field in self.module.fields][0:50]) # Note, limited to 50 fields at max | |
return f"/crm/v4/{self.module.api_name}?fields={fields}" | |
if len(self.module) > 50: | |
logger.warn("ZohoCRM only allow maximum of 50 parameter per query, the connector will drop: self.module.fields[50:]") | |
fields = ",".join([field.api_name for field in self.module.fields][0:50]) | |
return f"/crm/v4/{self.module.api_name}?fields={fields}" |
def request_headers( | ||
self, stream_state: Mapping[str, Any], stream_slice: Mapping[str, Any] = None, next_page_token: Mapping[str, Any] = None | ||
) -> Mapping[str, Any]: | ||
last_modified = stream_state.get(self.cursor_field, self._start_datetime) | ||
# since API filters inclusively, we add 1 sec to prevent duplicate reads | ||
last_modified_dt = datetime.datetime.fromisoformat(last_modified) | ||
last_modified_dt += datetime.timedelta(seconds=1) | ||
last_modified = last_modified_dt.isoformat("T", "seconds") | ||
return {"If-Modified-Since": last_modified} |
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.
Why are you removing this?
hey @richardlam-quotapath thanks for the contribution. Are you able to respond to the changes requested above? |
hey @richardlam-quotapath are you able to continue the PR? For now we'll close it and reopen once you have the time. |
What
The API Version was out of date which was causing issues because the v2 version has some modules return meta data with missing required fields.
Example: The deals endpoint with our customer's credentials was missing the "json_type" and "length" fields in the meta data which was causing the deals stream to not be available.
Also the optional fields in the FieldMeta class were not actually optional because they weren't being defaulted to None, local testing of that isolated code shows that if we have data missing the picklist_values field (which is supposed to be optional), the init() would fail because it wasn't being defaulted to None.
How
Fix #1
Update the zohocrm api version from v2 to v4
This will solve the ZohoCRM API returning data that is missing required fields issue
Fix #2
Have the class FieldMeta's optional fields be defaulted to None
This will solve the FieldMeta's init() failing on valid data due to missing optional fields issue
Re-testing shows the deals stream now available
Recommended reading order
This shows that dataclasses optional fields must be defaulted to a value
https://stackoverflow.com/questions/70809438/python-dataclasses-with-optional-attributes
🚨 User Impact 🚨
Some of our clients were not seeing key streams such as Deals due to this issue
Pre-merge Actions
Expand the relevant checklist and delete the others.
New Connector
Community member or Airbyter
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.0.0.1
Dockerfile
has version0.0.1
README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog with an entry for the initial version. See changelog exampledocs/integrations/README.md
Airbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
Updating a connector
Community member or Airbyter
Airbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
Connector Generator
-scaffold
in their name) have been updated with the latest scaffold by running./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates
then checking in your changes