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 c to parent tables ending in __ #51

Merged
merged 3 commits into from
Jul 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions tap_salesforce/salesforce/bulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,17 @@

# pylint: disable=inconsistent-return-statements
def find_parent(stream):
parent_stream = stream
if stream.endswith("CleanInfo"):
return stream[:stream.find("CleanInfo")]
parent_stream = stream[:stream.find("CleanInfo")]
elif stream.endswith("History"):
return stream[:stream.find("History")]
parent_stream = stream[:stream.find("History")]

# If the stripped stream ends with "__" we can assume the parent is a custom table
if parent_stream.endswith("__"):
parent_stream += 'c'

return parent_stream


class Bulk(object):
Expand Down Expand Up @@ -97,7 +104,7 @@ def _bulk_query(self, catalog_entry, state):
# Add the bulk Job ID and its batches to the state so it can be resumed if necessary
tap_stream_id = catalog_entry['tap_stream_id']
state = singer.write_bookmark(state, tap_stream_id, 'JobID', job_id)
state = singer.write_bookmark(state, tap_stream_id, 'BatchIDs', batch_status['completed'])
state = singer.write_bookmark(state, tap_stream_id, 'BatchIDs', batch_status['completed'][:])

for completed_batch_id in batch_status['completed']:
for result in self.get_batch_results(job_id, completed_batch_id, catalog_entry):
Expand Down
2 changes: 1 addition & 1 deletion tap_salesforce/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def sync_records(sf, catalog_entry, state, counter):
state,
catalog_entry['tap_stream_id'],
replication_key,
singer_utils.strptime(chunked_bookmark))
singer_utils.strftime(chunked_bookmark))

def fix_record_anytype(rec, schema):
"""Modifies a record when the schema has no 'type' element due to a SF type of 'anyType.'
Expand Down