-
Notifications
You must be signed in to change notification settings - Fork 17
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-26228 New Stream addition #95
base: master
Are you sure you want to change the base?
Conversation
CHANGELOG.md
Outdated
@@ -1,5 +1,8 @@ | |||
# Changelog | |||
|
|||
## 2.6.2 |
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.
It should be minor version.
if stream_version is None: | ||
stream_version = int(time.time() * 1000) | ||
singer.log_info("Using new activate version %s", stream_version) | ||
else: | ||
singer.log_info("Using interupted activate version %s", stream_version) | ||
return stream_version |
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.
if stream_version is None: | |
stream_version = int(time.time() * 1000) | |
singer.log_info("Using new activate version %s", stream_version) | |
else: | |
singer.log_info("Using interupted activate version %s", stream_version) | |
return stream_version | |
if stream_version: | |
singer.log_info("Using interupted activate version %s", stream_version) | |
else: | |
stream_version = int(time.time() * 1000) | |
singer.log_info("Using new activate version %s", stream_version) | |
return stream_version |
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.
since this condition is simplified and the changes are tested and validated, changing the sequence of the condition will not have any significant impact.
i would suggest against this change, unless this implementation is causing any adverse impact.
tap_marketo/sync.py
Outdated
data = client.request("GET", endpoint, endpoint_name="programs", params=params) | ||
if "warnings" in data and NO_ASSET_MSG in data["warnings"]: | ||
break | ||
if "errors" in data and data["errors"] != []: |
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.
Any specific reason, we are checking data["errors"] != []
? Can we use simplified condition like below,
if "errors" in data and data["errors"] != []: | |
if "errors" in data and data["errors"]: |
tap_marketo/sync.py
Outdated
if "warnings" in data and NO_ASSET_MSG in data["warnings"]: | ||
break |
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.
Should we log these warnings as well like errors?
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.
Same suggestion on L#581-L#582.
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.
those are not actual warnings, it just means that we have reached the end of the list and there are no more objects to iterate.
tap_marketo/sync.py
Outdated
|
||
def sync_program_tags(client, state, stream): | ||
singer.write_schema(stream["tap_stream_id"], stream["schema"], stream["key_properties"]) | ||
first_run = check_if_first_sync(state, stream["tap_stream_id"]) |
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.
To clearly convey that this is boolean variable, we should use name like is_first_run
or is_initail_sync
.
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.
Same suggestion on L#560.
tap_marketo/sync.py
Outdated
if last_synced_program: | ||
for indx, prog in enumerate(program_ids): | ||
if prog == last_synced_program: | ||
start = indx | ||
singer.log_info("Last Sync was interupted at index: %s program: %s",indx, prog) |
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.
if last_synced_program: | |
for indx, prog in enumerate(program_ids): | |
if prog == last_synced_program: | |
start = indx | |
singer.log_info("Last Sync was interupted at index: %s program: %s",indx, prog) | |
if last_synced_program_id: | |
for index, program_id in enumerate(program_ids): | |
if program_id == last_synced_program_id: | |
start = index | |
singer.log_info("Last Sync was interupted at index: %s program: %s", index, program_id) |
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.
Provided some suggestions in-line. In addtion to that please capitalise the new comments and docstrings added.
tap_marketo/discover.py
Outdated
if key_props: | ||
mdata = metadata.write(mdata, (), 'table-key-properties', key_props) | ||
else: | ||
mdata = metadata.write(mdata, (), 'table-key-properties', []) |
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.
if key_props: | |
mdata = metadata.write(mdata, (), 'table-key-properties', key_props) | |
else: | |
mdata = metadata.write(mdata, (), 'table-key-properties', []) | |
if not key_props: | |
key_props = [] | |
mdata = metadata.write(mdata, (), 'table-key-properties', key_props) |
tap_marketo/sync.py
Outdated
while True: | ||
data = client.request("GET", endpoint, endpoint_name="programs", params=params) | ||
if "warnings" in data and NO_ASSET_MSG in data["warnings"]: | ||
break |
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.
Avoid using while True
with a break
, instead create a has_more_data
flag and iterate using that.
tap_marketo/sync.py
Outdated
""" | ||
checks if the sync was interupted in-between an extraction | ||
if interupted returns the previous activate version number used | ||
else returns a new activate version | ||
""" |
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.
This docstring appears to be wrong
tap_marketo/sync.py
Outdated
state = bookmarks.write_bookmark(state, stream["tap_stream_id"],INITAL_SYNC_KEY, True) | ||
singer.write_state(state) | ||
|
||
state = bookmarks.write_bookmark(state, stream["tap_stream_id"], ACTIVATE_VERSION_KEY, stream_version) | ||
singer.write_state(state) |
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.
We do not need to be writing state twice consecutively here
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.
Not necessary, since both statements are consecutive.
However this block will be executed only once (i.e the first sync), hence i made the state to be explicitly written in the same block.
tap_marketo/sync.py
Outdated
while True: | ||
data = client.request("GET", endpoint, params=params) | ||
if "warnings" in data and NO_ASSET_MSG in data["warnings"]: | ||
break |
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.
Again avoid using while True
with a break
Co-authored-by: Rushikesh Todkar <98420315+RushiT0122@users.noreply.github.com>
Description of change
Adds Support for the following streams
Describe Leads (Provides Metadata about the lead's fields)
id
Program Tags (Provides tags associated with a program)
Tag Types (Provides Master table for tags)
Manual QA steps
Risks
Rollback steps