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-25607] : API version upgrade #67

Merged
merged 21 commits into from
May 23, 2024
Merged

Conversation

shantanu73
Copy link
Contributor

@shantanu73 shantanu73 commented May 15, 2024

Description of change

Klaviyo is moving it's legacy APIs v1/v2 to new APIs as per this document.
The following changes are made to include these API changes:

  1. Changed the base url for all streams
  2. Moved API key authorization from query params to request headers
  3. Modified schema for all streams to include all relevant fields.
  4. Modified transformation logic to flatten the API response and get all relevant fields.
  5. Python version upgrade to be compatible with v3.11.7 and module version upgrades taken from this PR
  6. Events stream mapping change taken from this PR by @jwhitneyinsurify

Manual QA steps

  • Ran syncs for customer connection

Risks

  • Old API implementation is getting deprecated and it'll sunset soon, will cause connections to fail.

Rollback steps

  • revert this branch

shantanu73 and others added 14 commits May 15, 2024 03:50
1. Added new APIs for metrics & events streams and removed metric stream which is deprecated.
2. Added API_VERSION which is going to part of headers in Klaviyo API calls.
3. Made code changes to include changes in response of new APIs.
4. Added API_KEY in headers which will be used for authorizing Klaviyo APIs in new implementation.
1. Added headers in authed_get to include authorization parameter in headers for new Klaviyo API implementation.
2. Added request params for GET API calls for Klaviyo.
3. Added logic to flatten the event response to include all relevant fields.
1. Modified base urls for all FULL table streams.
2. Modified schemas for all FULL table streams.
1. Fixed logic for transfrom_and_write_records method to include FULL table streams.
2. Added query params for FULL table streams to be included in API calls.
3. Removed get_all_pages method as all the streams use cursor based pagination now.
4. Fixed pagination logic in get_all_using_next method.
…ype for all relationship attributes from object to array.
1. Fixed pagination logic.
2. Fixed get_available_metrics method.
…tap-klaviyo into TDL-25607-API-version-upgrade
1. Added schemas for some streams and removed schemas for streams which don't exist in new API implementation.
2. Changed primary key for global_exclusions from email to id.
config.sample.json Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@rdeshmukh15
Copy link
Contributor

Klaviyo metrics API link should be updated to the latest in README.md

@rdeshmukh15
Copy link
Contributor

rdeshmukh15 commented May 20, 2024

Have you compared the synced data for old and new both the versions with same start_date for all the streams?

@shantanu73
Copy link
Contributor Author

Have you compared the synced data for old and new both the versions with same start_date for all the streams?

Yes, and the results were same for old and new implementations.

shantanu73 and others added 2 commits May 21, 2024 13:45
* Changes:
1. Added and removed relevant streams to fix discovery test.
2. Removed unsubscribe stream as the test account does not have sufficient data to test it.

* Fixed All fields & Automatic fields tests.

* Fixed comments for all fields & automatic fields tests.

* Changes:
1. Fixed bookmark test and added appropriate streams with insufficient data in untestable_streams.
2. Fixed start date test and changed assertions for specific streams as per data avilable.
3. Fixed pagination test by keeping different page sizes for different streams.

* Modified Klaviyo API docs link in README.

* Update config.yml - use stitch-tap-tester image (#69)

* Update config.yml

* assert changed

* Updates for python 3.11 (#66)

* Updates for python 3.11

* Update CHANGELOG.md [skip ci]

* update circle config

* pylint happy

* install pylint

-----------------------------

* typo

-----------------------------

* removed bump version changes

* changes config.yml

* changes in config.yml to pass unit tests

* fixes unit tests

* changes in config.yml in setup step

* linting command change in config.yml

* added step to install pylint in config.yml

---------

Co-authored-by: “rdeshmukh15” <[email protected]>

* updated docker image in config.yml

---------

Co-authored-by: Patrick Lynskey <[email protected]>
Co-authored-by: “rdeshmukh15” <[email protected]>
Co-authored-by: Leslie VanDeMark <[email protected]>
tap_klaviyo/utils.py Outdated Show resolved Hide resolved
tap_klaviyo/utils.py Outdated Show resolved Hide resolved
1. Changed included list to dict to optimize computations.
This is a review comment resolution.
1. Created STREAM_PARAMS_MAP to get params_list for each FULL_TABLE stream to avoid if-else condition.
This change is part of review comment resolution.
@shantanu73 shantanu73 merged commit 0af8fa5 into master May 23, 2024
3 checks passed
@rdeshmukh15 rdeshmukh15 mentioned this pull request Dec 6, 2024
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