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

🎉 source Salesloft: added several new streams #11460

Conversation

yannibenoit
Copy link
Contributor

@yannibenoit yannibenoit commented Mar 28, 2022

What

Issue: #11198
Community Slack Message: https://airbytehq.slack.com/archives/C01VDDEGL7M/p1647435938137639

New sources added for Salesloft integration ->

image

How

For each new stream :

  • Added new schema *.json for this new endpoint
  • Added new IncrementalSalesloftStream or SalesloftStream class
  • Edited streams method in SourceSalesloft class to add new class in return
  • Edited test_source.py to allow one more stream when unit testing

Recommended reading order

  1. emails.json
  2. account_stages.json
  3. account_tiers.json
  4. accounts.json
  5. actions.json
  6. calls.json
  7. email_templates.json
  8. import.json
  9. notes.json
  10. person_stages.json
  11. phone_number_assignments.json
  12. steps.json
  13. team_templates.json
  14. groups.json
  15. crm_activities.json
  16. crm_users.json
  17. email_template_attachments.json
  18. team_template_attachments.json
  19. successes.json
  20. source.py
  21. test_source.py

🚨 User Impact 🚨

New streams will be available in connector settings

image

New tables will be available in destination

**
image
**

Pre-merge Checklist

Expand the relevant checklist and delete the others.

Updating a connector

Community member or Airbyter

  • Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • Changelog updated in docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • If new credentials are required for use in CI, add them to GSM. Instructions.
  • /test connector=connectors/<name> command is passing
  • New Connector version released on Dockerhub by running the /publish command described here
  • After the new connector version is published, connector version bumped in the seed directory as described here
  • Seed specs have been re-generated by building the platform and committing the changes to the seed spec files, as described here

Tests

Unit

Put your unit tests output here.

Integration

Put your integration tests output here.

Acceptance

Put your acceptance tests output here.

@github-actions github-actions bot added the area/connectors Connector related issues label Mar 28, 2022
@github-actions github-actions bot added the area/documentation Improvements or additions to documentation label Mar 28, 2022
@yannibenoit yannibenoit marked this pull request as draft April 6, 2022 11:31
@marcosmarxm
Copy link
Member

@yannibenoit ping me when this is ready to review.

@yannibenoit
Copy link
Contributor Author

Warning: there are some API Limits errors but sync went well :)

2022-04-11 12:09:52 source > Caught retryable error 'Request URL: https://api.salesloft.com/v2/crm_activities?per_page=100&page=947, Response Code: 429, Response Text: {"error":"API rate limit exceeded"}

@yannibenoit
Copy link
Contributor Author

Needed to edit next_page_token method to check if paging key was available in response metadata because that cause the sync stream error below

2022-04-11 12:38:19 source > Encountered an exception while reading stream groups
Traceback (most recent call last):
  File "/airbyte/integration_code/source_salesloft/source.py", line 33, in next_page_token
    next_page = response.json()["metadata"]["paging"].get("next_page")
KeyError: 'paging'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/airbyte_cdk/sources/abstract_source.py", line 119, in read
    internal_config=internal_config,
  File "/usr/local/lib/python3.7/site-packages/airbyte_cdk/sources/abstract_source.py", line 159, in _read_stream
    for record in record_iterator:
  File "/usr/local/lib/python3.7/site-packages/airbyte_cdk/sources/abstract_source.py", line 248, in _read_full_refresh
    for record in records:
  File "/usr/local/lib/python3.7/site-packages/airbyte_cdk/sources/streams/http/http.py", line 376, in read_records
    next_page_token = self.next_page_token(response)
  File "/airbyte/integration_code/source_salesloft/source.py", line 36, in next_page_token
    raise KeyError(f"error parsing next_page token: {e}")
KeyError: "error parsing next_page token: 'paging'"

@yannibenoit yannibenoit marked this pull request as ready for review April 11, 2022 13:32
@yannibenoit
Copy link
Contributor Author

@yannibenoit ping me when this is ready to review.

@marcosmarxm it's good for review now

@alafanechere alafanechere self-assigned this Apr 12, 2022
@alafanechere
Copy link
Contributor

alafanechere commented Apr 15, 2022

/test connector=connectors/source-salesloft

🕑 connectors/source-salesloft https://github.com/airbytehq/airbyte/actions/runs/2171457991
✅ connectors/source-salesloft https://github.com/airbytehq/airbyte/actions/runs/2171457991
Python tests coverage:

Name                                                 Stmts   Miss  Cover
------------------------------------------------------------------------
source_acceptance_test/utils/__init__.py                 6      0   100%
source_acceptance_test/tests/__init__.py                 4      0   100%
source_acceptance_test/__init__.py                       2      0   100%
source_acceptance_test/tests/test_full_refresh.py       52      2    96%
source_acceptance_test/utils/asserts.py                 37      2    95%
source_acceptance_test/config.py                        74      6    92%
source_acceptance_test/utils/json_schema_helper.py     105     13    88%
source_acceptance_test/utils/common.py                  70     17    76%
source_acceptance_test/utils/compare.py                 62     23    63%
source_acceptance_test/tests/test_core.py              285    106    63%
source_acceptance_test/base.py                          10      4    60%
source_acceptance_test/utils/connector_runner.py       110     48    56%
source_acceptance_test/tests/test_incremental.py        69     38    45%
------------------------------------------------------------------------
TOTAL                                                  886    259    71%
Name                                                                                                                            Stmts   Miss  Cover
---------------------------------------------------------------------------------------------------------------------------------------------------
base_python/cdk/utils/casing.py                                                                                                     4      0   100%
base_python/__init__.py                                                                                                            13      0   100%
/actions-runner/_work/airbyte/airbyte/airbyte-integrations/bases/airbyte-protocol/airbyte_protocol/models/airbyte_protocol.py     124      0   100%
/actions-runner/_work/airbyte/airbyte/airbyte-integrations/bases/airbyte-protocol/airbyte_protocol/models/__init__.py               1      0   100%
/actions-runner/_work/airbyte/airbyte/airbyte-integrations/bases/airbyte-protocol/airbyte_protocol/__init__.py                      2      0   100%
base_python/cdk/utils/event_timing.py                                                                                              47      3    94%
base_python/cdk/streams/auth/core.py                                                                                                8      1    88%
base_python/cdk/streams/exceptions.py                                                                                              10      2    80%
base_python/cdk/streams/auth/token.py                                                                                               9      4    56%
base_python/logger.py                                                                                                              33     15    55%
base_python/cdk/streams/rate_limiting.py                                                                                           30     14    53%
base_python/integration.py                                                                                                         52     25    52%
base_python/cdk/streams/http.py                                                                                                    67     33    51%
base_python/cdk/streams/core.py                                                                                                    63     32    49%
base_python/client.py                                                                                                              56     33    41%
base_python/catalog_helpers.py                                                                                                     10      6    40%
base_python/source.py                                                                                                              51     34    33%
base_python/cdk/streams/auth/oauth.py                                                                                              37     26    30%
base_python/cdk/abstract_source.py                                                                                                 89     64    28%
base_python/schema_helpers.py                                                                                                      56     41    27%
base_python/entrypoint.py                                                                                                          70     56    20%
---------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                                                                                             832    389    53%
Name                           Stmts   Miss  Cover
--------------------------------------------------
source_salesloft/__init__.py       2      0   100%
source_salesloft/source.py       161     36    78%
--------------------------------------------------
TOTAL                            163     36    78%

@alafanechere
Copy link
Contributor

alafanechere commented Apr 19, 2022

/publish connector=connectors/source-salesloft auto-bump-version=false

🕑 connectors/source-salesloft https://github.com/airbytehq/airbyte/actions/runs/2189823045
🚀 Successfully published connectors/source-salesloft
✅ connectors/source-salesloft https://github.com/airbytehq/airbyte/actions/runs/2189823045

@alafanechere
Copy link
Contributor

Thank you @yannibenoit for this big improvement!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues area/documentation Improvements or additions to documentation community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants