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 Intercom: Added conversation_id field to conversation_part records #11206

Conversation

lgomezm
Copy link
Contributor

@lgomezm lgomezm commented Mar 16, 2022

What

Records from the ConversationParts stream don't have conversation_id, so in a scenario where a connection is configured to sync conversations and conversation_parts, there is no hay to determine what conversation_parts belong to what conversations at the destination.

How

Added the conversation_id property to the records yielded by the ConversationParts stream.

Recommended reading order

  1. source.py
  2. unit_test.py

🚨 User Impact 🚨

Are there any breaking changes? What is the end result perceived by the user? If yes, please merge this PR with the 🚨🚨 emoji so changelog authors can further highlight this if needed.

Pre-merge Checklist

Expand the relevant checklist and delete the others.

New Connector

Community member or Airbyter

  • Community member? 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
    • docs/SUMMARY.md
    • docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
    • docs/integrations/README.md
    • airbyte-integrations/builds.md
  • 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 connector is published, connector added to connector index 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
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
Connector Generator
  • Issue acceptance criteria met
  • PR name follows PR naming conventions
  • If adding a new generator, add it to the list of scaffold modules being tested
  • The generator test modules (all connectors with -scaffold in their name) have been updated with the latest scaffold by running ./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates then checking in your changes
  • Documentation which references the generator is updated as needed

Tests

Unit

Put your unit tests output here.

Integration

Put your integration tests output here.

Acceptance

Put your acceptance tests output here.

@lgomezm
Copy link
Contributor Author

lgomezm commented Mar 16, 2022

Since I added a new unit tests, here's the unit test execution:
Screen Shot 2022-03-16 at 2 00 57 PM
I had no success at running the integration tests. It looks like they are configured to run with a test account I don't have access to. Please run them when you get a chance.

@lgomezm lgomezm changed the title Source Intercom: Added conversation_id field to conversation_part records 🎉 Source Intercom: Added conversation_id field to conversation_part records Mar 16, 2022
@github-actions github-actions bot added the area/connectors Connector related issues label Mar 16, 2022
@alafanechere alafanechere self-assigned this Mar 21, 2022
Copy link
Contributor

@alafanechere alafanechere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution @lgomezm! I made a minor suggestion. I'll run the acceptance tests and will approve/request changes according to results 🥁

Comment on lines 308 to 309
if 'conversation_id' not in conversation_part:
conversation_part['conversation_id'] = conversation_id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if 'conversation_id' not in conversation_part:
conversation_part['conversation_id'] = conversation_id
conversation_part.setdefault("conversation_id", "conversation_id")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in c88184b.

@alafanechere
Copy link
Contributor

alafanechere commented Mar 22, 2022

/test connector=connectors/source-intercom

🕑 connectors/source-intercom https://github.com/airbytehq/airbyte/actions/runs/2021143885
❌ connectors/source-intercom https://github.com/airbytehq/airbyte/actions/runs/2021143885
🐛 https://gradle.com/s/cqagvp74hyhpc

Copy link
Contributor

@alafanechere alafanechere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lgomezm the tests are failing because you did not run ./gradlew format. Please run it and push the changes. You'll have to rename the unit test you declared to make the flake test pass. I'm ready to merge it afterward.

@@ -76,3 +76,35 @@ def test_switch_to_standard_endpoint_if_scroll_expired(requests_mock):
records += list(stream1.read_records(sync_mode=SyncMode, stream_slice=slice))

assert stream1._endpoint_type == Companies.EndpointType.standard


def test_switch_to_standard_endpoint_if_scroll_expired(requests_mock):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is badly named and another these already has this name.

Suggested change
def test_switch_to_standard_endpoint_if_scroll_expired(requests_mock):
def test_conversation_part_has_conversation_id(requests_mock):

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Updated in 8aebb16

@lgomezm
Copy link
Contributor Author

lgomezm commented Mar 22, 2022

@alafanechere I've addressed your comments and ran gradlew format. Please let me know if there's anything else I should do. Thanks for reviewing!

@alafanechere
Copy link
Contributor

alafanechere commented Mar 23, 2022

/test connector=connectors/source-intercom

🕑 connectors/source-intercom https://github.com/airbytehq/airbyte/actions/runs/2028679661
✅ connectors/source-intercom https://github.com/airbytehq/airbyte/actions/runs/2028679661
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              275    106    61%
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                                                  876    259    70%
Name                          Stmts   Miss  Cover
-------------------------------------------------
source_intercom/__init__.py       2      0   100%
source_intercom/source.py       224     42    81%
-------------------------------------------------
TOTAL                           226     42    81%
Name                          Stmts   Miss  Cover
-------------------------------------------------
source_intercom/__init__.py       2      0   100%
source_intercom/source.py       224     55    75%
-------------------------------------------------
TOTAL                           226     55    76%

Copy link
Contributor

@alafanechere alafanechere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lgomezm I'm ready to publish the new version. Could you please bump the version number in:

  • airbyte-integrations/connectors/source-intercom/Dockerfile
  • airbyte-config/init/src/main/resources/seed/source_definitions.yaml

Please also update the changelog in docs/integrations/sources/intercom.md.

I'll then run the publish command from the comments. Afterward you need to locally run ./gradlew airbyte-config:init:processResources . This will update the /Users/augustin/workspace/airbyte/airbyte-config/init/src/main/resources/seed/source_specs.yaml, please then commit this file.

I would have liked to do this myself but as I don't have push permission on your organization fork I need to ask you to do this 😄

@github-actions github-actions bot added the area/documentation Improvements or additions to documentation label Mar 23, 2022
@lgomezm lgomezm force-pushed the lgomez/intercom_conversation_parts_with_conversation_id branch from 35e3909 to 70216ed Compare March 23, 2022 14:42
@lgomezm
Copy link
Contributor Author

lgomezm commented Mar 23, 2022

@alafanechere In 70216ed, I've updated:

  • airbyte-integrations/connectors/source-intercom/Dockerfile
  • airbyte-config/init/src/main/resources/seed/source_definitions.yaml
  • docs/integrations/sources/intercom.md

Please let me know when you publish, so I can run that final gradle command and push the changes again.

@alafanechere
Copy link
Contributor

alafanechere commented Mar 24, 2022

/publish connector=connectors/source-intercom

🕑 connectors/source-intercom https://github.com/airbytehq/airbyte/actions/runs/2036278591
✅ connectors/source-intercom https://github.com/airbytehq/airbyte/actions/runs/2036278591

@alafanechere
Copy link
Contributor

@lgomezm the connector is published, please run ./gradlew airbyte-config:init:processResources and commit + push the change made to the source_specs.yaml file. We can merge afterward 🎉

@lgomezm
Copy link
Contributor Author

lgomezm commented Mar 25, 2022

@alafanechere Done. source_specs.yaml was updated in 1dd4fd5.

Copy link
Contributor

@alafanechere alafanechere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this contrib @lgomezm !

@alafanechere alafanechere merged commit 787daa9 into airbytehq:master Mar 25, 2022
@lgomezm lgomezm deleted the lgomez/intercom_conversation_parts_with_conversation_id branch March 25, 2022 19:19
@lazebnyi lazebnyi linked an issue Mar 31, 2022 that may be closed by this pull request
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.

Source Intercom: conversion_parts is not fetched by the source
3 participants