Skip to content

Commit

Permalink
Bump api v52.0 (#116)
Browse files Browse the repository at this point in the history
* Add spike to test daemon threads

* bump api to v52.0

* WIP some test and code changes for api bump

* updated tests to include new streams and exclude unsupported new streams

* sorted list of expected streams

* fix discovery test

* discovery test edit

* remove TODO
  • Loading branch information
zachharris1 authored Sep 9, 2021
1 parent 0029e9b commit 1eb7c2b
Show file tree
Hide file tree
Showing 5 changed files with 254 additions and 334 deletions.
15 changes: 11 additions & 4 deletions tap_salesforce/salesforce/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@
'PartnerRole',
'TaskPriority',
'CaseStatus',
'UndecidedEventRelation'])
'UndecidedEventRelation',
'OrderStatus'])

# The following objects have certain WHERE clause restrictions so we exclude them.
QUERY_RESTRICTED_SALESFORCE_OBJECTS = set(['Announcement',
Expand All @@ -103,7 +104,13 @@
'RelationshipDomain',
'FlexQueueItem',
'NetworkUserHistoryRecent',
'FieldHistoryArchive',])
'FieldHistoryArchive',
'RecordActionHistory',
'FlowVersionView',
'FlowVariableView',
'AppTabMember',
'ColorDefinition',
'IconDefinition',])

# The following objects are not supported by the query method being used.
QUERY_INCOMPATIBLE_SALESFORCE_OBJECTS = set(['DataType',
Expand Down Expand Up @@ -162,7 +169,7 @@ def field_to_property_schema(field, mdata): # pylint:disable=too-many-branches
"latitude": {"type": ["null", "number"]},
"geocodeAccuracy": {"type": ["null", "string"]}
}
elif sf_type == "int":
elif sf_type in ("int", "long"):
property_schema['type'] = "integer"
elif sf_type == "time":
property_schema['type'] = "string"
Expand Down Expand Up @@ -226,7 +233,7 @@ def __init__(self,
self.rest_requests_attempted = 0
self.jobs_completed = 0
self.login_timer = None
self.data_url = "{}/services/data/v41.0/{}"
self.data_url = "{}/services/data/v52.0/{}"
self.pk_chunking = False

# validate start_date
Expand Down
6 changes: 3 additions & 3 deletions tap_salesforce/salesforce/bulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def find_parent(stream):

class Bulk():

bulk_url = "{}/services/async/41.0/{}"
bulk_url = "{}/services/async/52.0/{}"

def __init__(self, sf):
# Set csv max reading size to the platform's max size available.
Expand Down Expand Up @@ -73,10 +73,10 @@ def check_bulk_quota_usage(self):
with metrics.http_request_timer(endpoint):
resp = self.sf._make_request('GET', url, headers=self.sf._get_standard_headers()).json()

quota_max = resp['DailyBulkApiRequests']['Max']
quota_max = resp['DailyBulkApiBatches']['Max']
max_requests_for_run = int((self.sf.quota_percent_per_run * quota_max) / 100)

quota_remaining = resp['DailyBulkApiRequests']['Remaining']
quota_remaining = resp['DailyBulkApiBatches']['Remaining']
percent_used = (1 - (quota_remaining / quota_max)) * 100

if percent_used > self.sf.quota_percent_total:
Expand Down
2 changes: 1 addition & 1 deletion tap_salesforce/salesforce/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def _query_recur(
end_date=None,
retries=MAX_RETRIES):
params = {"q": query}
url = "{}/services/data/v41.0/queryAll".format(self.sf.instance_url)
url = "{}/services/data/v52.0/queryAll".format(self.sf.instance_url)
headers = self.sf._get_standard_headers()

sync_start = singer_utils.now()
Expand Down
Loading

0 comments on commit 1eb7c2b

Please sign in to comment.