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

TDL-26523: Upgrade salesforce API version to v61 #184

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

prijendev
Copy link

@prijendev prijendev commented Oct 8, 2024

Description of change

  • Upgrading current salesforce API version 52.0 to 61.0
  • Following are the key changes
    • A total of 258 new objects have been introduced in version 61.0.
    • One object that is available in version 52.0 has been removed in version 61.0.
      • CustomObjectUserLicenseMetrics
    • The following streams are currently available as INCREMENTAL but are not functioning correctly INCREMENTAL. Therefore, we will mark them as FULL_TABLE in the next release.
      • PermissionSetEventStore
      • ListViewEvent
      • IdentityProviderEventStore
      • ApiEvent
      • BulkApiResultEventStore
      • IdentityVerificationEvent
      • 'LoginAsEvent
    • We do not have access to extract data for the following streams. It is mentioned here that objects associated with Data.com may throw errors on request.
      • DatacloudAddress
      • DatacloudDandBCompany
    • We will skip the following streams for both REST and BULK type sync, as they are query-restricted objects.
      Although the following streams are listed as supported for Bulk API in the current version of the tap, they are not functioning as expected with the Bulk sync. So, will skip these streams in Bulk Sync
      • WorkStepStatus
      • FieldSecurityClassification
      • WorkOrderStatus
      • ShiftStatusWorkOrderLineItemStatus

QA steps

  • automated tests passing
  • manual qa steps passing
    • Verify that the discover mode is working as expected in the case of REST and BULK type.
      • Verify total replicated streams
      • Verify the primary key and replication key of streams
      • Verify replication method
      • Verify unsupported streams and fields
    • Verify that sync mode is working by selecting all the fields and streams
      • Verify that the final state is generated with the expected bookmark value
      • Verify that tap is not breaking anywhere for all the supported streams
      • Verify that tap is working as expected with the state as well

Risks

Rollback steps

  • revert this branch

AI generated code

https://internal.qlik.dev/general/ways-of-working/code-reviews/#guidelines-for-ai-generated-code

  • this PR has been written with the help of GitHub Copilot or another generative AI tool

@@ -62,29 +62,25 @@ jobs:
path: test_output/report.xml
- store_artifacts:
path: htmlcov
run_integration_tests:
Copy link
Author

Choose a reason for hiding this comment

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

In the parallel run, tests are failing. Switching them to run in a serialized manner.

@cngpowered
Copy link
Member

We will skip the following streams for both REST and BULK type sync, as they are query-restricted objects.
Although the following streams are listed as supported for Bulk API in the current version of the tap, they are not functioning as expected with the Bulk sync. So, will skip these streams in Bulk Sync
WorkStepStatus
FieldSecurityClassification
WorkOrderStatus
ShiftStatusWorkOrderLineItemStatus

In the current version of the tap, are these streams able to extract records?

@@ -111,6 +112,12 @@
'FlowVariableView',
'AppTabMember',
'ColorDefinition',
'DatacloudDandBCompany', # Not filterable without a criteria.
Copy link
Member

Choose a reason for hiding this comment

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

Not filterable without a criteria

Is the comment Correct here?

Copy link
Author

Choose a reason for hiding this comment

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

This is an error message I have added over here. General comment is already written on top of this list

@@ -235,7 +243,7 @@ def __init__(self,
self.rest_requests_attempted = 0
self.jobs_completed = 0
self.login_timer = None
self.data_url = "{}/services/data/v52.0/{}"
self.data_url = "{}/services/data/v61.0/{}"
Copy link
Member

Choose a reason for hiding this comment

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

define a constant for this version number and utilize it in the tap

Copy link
Author

@prijendev prijendev Oct 10, 2024

Choose a reason for hiding this comment

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

I think constant is not required here because It is just used for a single time in this module.

@@ -41,7 +41,7 @@ def find_parent(stream):

class Bulk():

bulk_url = "{}/services/async/52.0/{}"
bulk_url = "{}/services/async/61.0/{}"
Copy link
Member

Choose a reason for hiding this comment

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

define a constant for this version number and utilize it in the tap

Copy link
Author

@prijendev prijendev Oct 10, 2024

Choose a reason for hiding this comment

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

I think constant is not required here because It is just used for a single time in this module.

@@ -28,7 +28,7 @@ def _query_recur(
end_date=None,
retries=MAX_RETRIES):
params = {"q": query}
url = "{}/services/data/v52.0/queryAll".format(self.sf.instance_url)
url = "{}/services/data/v61.0/queryAll".format(self.sf.instance_url)
Copy link
Member

Choose a reason for hiding this comment

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

define a constant for this version number and utilize it in the tap

Copy link
Author

Choose a reason for hiding this comment

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

I think constant is not required here because It is just used for a single time in this module.

Copy link
Member

Choose a reason for hiding this comment

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

since this version is referenced multiple times, create a single constant where it can be referenced in all the modules.

Copy link
Author

Choose a reason for hiding this comment

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

Done, I have added a constant for the API version and utilized it for all other places.

Comment on lines +434 to +435
'IdentityProviderEventStore': default_full, # new
'IdentityVerificationEvent': default_full, # new
Copy link
Member

Choose a reason for hiding this comment

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

please provide link to the documentation of the streams that have changed replication methods

Copy link
Author

Choose a reason for hiding this comment

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

There is no documentation link for replication of these objects. Only when we run sync mode will we be able to know this behavior.

@cngpowered
Copy link
Member

Please add a changelog and version bump in the PR

@@ -199,6 +206,7 @@ def field_to_property_schema(field, mdata): # pylint:disable=too-many-branches

return property_schema, mdata

#pylint: disable=too-many-positional-arguments
Copy link
Contributor

Choose a reason for hiding this comment

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

I was skimming this PR and thought it was weird to disable a linter for the whole class. So I just wanted to note that this class level disable is to fix things for just two methods.

Here's a pylint run after deleting this line:

$ pylint tap_salesforce -d 'broad-except,broad-exception-caught,broad-exception-raised,chained-comparison,empty-docstring,fixme,invalid-name,line-too-long,missing-class-docstring,missing-function-docstring,missing-module-docstring,no-else-raise,no-else-return,too-few-public-methods,too-many-arguments,too-many-branches,too-many-lines,too-many-locals,ungrouped-imports,wrong-spelling-in-comment,wrong-spelling-in-docstring,consider-using-f-string,logging-fstring-interpolation,wrong-import-order,stop-iteration-return,logging-format-interpolation'
************* Module tap_salesforce.salesforce
tap_salesforce/salesforce/__init__.py:211:4: R0917: Too many positional arguments (12/5) (too-many-positional-arguments)
tap_salesforce/salesforce/__init__.py:292:4: R0917: Too many positional arguments (7/5) (too-many-positional-arguments)

-------------------------------------------------------------------
Your code has been rated at 9.98/10 (previous run: 10.00/10, -0.02)

And here's the changes to get this back to a 10/10 rating

diff --git a/tap_salesforce/salesforce/__init__.py b/tap_salesforce/salesforce/__init__.py
index f144b53..2a334cc 100644
--- a/tap_salesforce/salesforce/__init__.py
+++ b/tap_salesforce/salesforce/__init__.py
@@ -206,9 +206,8 @@ def field_to_property_schema(field, mdata): # pylint:disable=too-many-branches

     return property_schema, mdata

-#pylint: disable=too-many-positional-arguments
 class Salesforce():
-    # pylint: disable=too-many-instance-attributes,too-many-arguments
+    # pylint: disable=too-many-instance-attributes,too-many-arguments,too-many-positional-arguments
     def __init__(self,
                  refresh_token=None,
                  token=None,
@@ -284,7 +283,7 @@ class Salesforce():
                                                                        self.quota_percent_per_run)
             raise TapSalesforceQuotaExceededException(partial_message)

-    # pylint: disable=too-many-arguments
+    # pylint: disable=too-many-arguments,too-many-positional-arguments
     @backoff.on_exception(backoff.expo,
                           (requests.exceptions.ConnectionError, requests.exceptions.Timeout),
                           max_tries=10,

Maybe we should open a separate issue to clean up some of these inline disables. For example, too-many-arguments appears in $PYLINT_DISABLE_LIST and doesn't need to be inlined anymore

Copy link
Author

Choose a reason for hiding this comment

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

Moved these class level inline pylint disables to function level. Created separate ticket to clean these inline disables - TDL-26624

@@ -3,7 +3,7 @@
from setuptools import setup

setup(name='tap-salesforce',
version='2.0.1',
Copy link
Member

Choose a reason for hiding this comment

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

This P.R qualify's for a minor version release, since we are changing a lot of things.
I will suggest to use 2.1.0 over 2.0.1

Copy link
Author

Choose a reason for hiding this comment

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

Agree. I have updated it

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