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 MailGun: Migrate Python CDK to Low-code CDK #29122

Merged
merged 17 commits into from Aug 17, 2023

Conversation

btkcodedev
Copy link
Collaborator

@btkcodedev btkcodedev commented Aug 5, 2023

What

Migrating Source Mailgun to Low-Code CDK
Closes #29120

How

Developed using (Configuration Based Source) low-code CDK

Recommended reading order

  1. spec.yaml
  2. manifest.yaml
  3. schemas/*

Tests

Integration & Acceptance Full Test Results

🚨 User Impact 🚨

  • No breaking changes, migration to low-code
Migrate Connector: Source Mailgun

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
    • 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

@octavia-squidington-iii octavia-squidington-iii added area/connectors Connector related issues area/documentation Improvements or additions to documentation community connectors/source/mailgun labels Aug 5, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2023

Before Merging a Connector Pull Request

Wow! What a great pull request you have here! 🎉

To merge this PR, ensure the following has been done/considered for each connector added or updated:

  • PR name follows PR naming conventions
  • Breaking changes are considered. If a Breaking Change is being introduced, ensure an Airbyte engineer has created a Breaking Change Plan.
  • Connector version has been incremented in the Dockerfile and metadata.yaml according to our Semantic Versioning for Connectors guidelines
  • You've updated the connector's metadata.yaml file any other relevant changes, including a breakingChanges entry for major version bumps. See metadata.yaml docs
  • Secrets in the connector's spec are annotated with airbyte_secret
  • All documentation files are up to date. (README.md, bootstrap.md, docs.md, etc...)
  • Changelog updated in docs/integrations/<source or destination>/<name>.md with an entry for the new version. See changelog example
  • Migration guide updated in docs/integrations/<source or destination>/<name>-migrations.md with an entry for the new version, if the version is a breaking change. See migration guide example
  • If set, you've ensured the icon is present in the platform-internal repo. (Docs)

If the checklist is complete, but the CI check is failing,

  1. Check for hidden checklists in your PR description

  2. Toggle the github label checklist-action-run on/off to re-run the checklist CI.

@btkcodedev btkcodedev changed the title Migrate to lowcode ✨Source MailGun: Migrate Python CDK to Low-code CDK Aug 5, 2023
@btkcodedev
Copy link
Collaborator Author

Test results: Passed state:
image

@btkcodedev
Copy link
Collaborator Author

Waiting for #28471 for merging to update start_date

@btkcodedev btkcodedev marked this pull request as ready for review August 5, 2023 09:15
@marcosmarxm
Copy link
Member

Waiting for #28471 for merging to update start_date

Go ahead and fix the start date directly here.

@btkcodedev
Copy link
Collaborator Author

@marcosmarxm It's Hitting with backward compatibility test errors, any suggestions?

btkcodedev and others added 2 commits August 8, 2023 19:20
…-config.yml

Co-authored-by: Marcos Marx <marcosmarxm@users.noreply.github.com>
@marcosmarxm marcosmarxm added the team/tse Technical Support Engineers label Aug 8, 2023
@btkcodedev btkcodedev mentioned this pull request Aug 8, 2023
@marcosmarxm marcosmarxm added the Hackathon External low-code/ui connector builder hackathons label Aug 9, 2023
Copy link
Member

@marcosmarxm marcosmarxm left a comment

Choose a reason for hiding this comment

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

Left some comments, the connector is missing pagination.

Comment on lines 7 to 9
enabled: false
cloud:
enabled: false
Copy link
Member

Choose a reason for hiding this comment

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

Why ar eyou changing this?

enabled: true
oss:
enabled: true
releaseDate: TODO
Copy link
Member

Choose a reason for hiding this comment

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

Add a date here

Comment on lines +28 to +29
paginator:
type: NoPagination
Copy link
Member

Choose a reason for hiding this comment

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

Please add pagination as it was implemented before

def next_page_token(self, response: requests.Response) -> Optional[Mapping[str, HttpUrl]]:
"""
:param response: the most recent response from the API
:return If there is another page in the result, a mapping (e.g: dict) containing information needed to query the next page in the response.
If there are no more pages in the result, return None.
"""
next_page: Optional[HttpUrl] = response.json().get("paging", {}).get("next")
return {"url": next_page} if next_page and self._pre_parse_response(response) else None

stream_names:
- "domains"
- "events"

Copy link
Member

Choose a reason for hiding this comment

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

EOF

@btkcodedev
Copy link
Collaborator Author

All comments resolved
Test result passed state

@btkcodedev
Copy link
Collaborator Author

image

@sajarin
Copy link
Contributor

sajarin commented Aug 14, 2023

@btkcodedev getting an error with the check command with the events stream:

{"type": "LOG", "log": {"level": "ERROR", "message": "Encountered an error trying to connect to stream events. Error: \n Traceback (most recent call last):\n File \"/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/checks/check_stream.py\", line 42, in check_connection\n stream_is_available, reason = availability_strategy.check_availability(stream, logger, source)\n File \"/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/availability_strategy.py\", line 36, in check_availability\n stream_slice = get_first_stream_slice(stream)\n File \"/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/streams/utils/stream_helper.py\", line 21, in get_first_stream_slice\n stream.stream_slices(\n File \"/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/declarative_stream.py\", line 126, in stream_slices\n return self.retriever.stream_slices()\n File \"/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/retrievers/simple_retriever.py\", line 348, in stream_slices\n return self.stream_slicer.stream_slices()\n File \"/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/incremental/datetime_based_cursor.py\", line 141, in stream_slices\n start_datetime = self._calculate_earliest_possible_value(self._select_best_end_datetime())\n File \"/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/incremental/datetime_based_cursor.py\", line 146, in _calculate_earliest_possible_value\n earliest_possible_start_datetime = min(self.start_datetime.get_datetime(self.config), end_datetime)\n File \"/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/datetime/min_max_datetime.py\", line 58, in get_datetime\n time = self._parser.parse(str(self.datetime.eval(config, **additional_parameters)), datetime_format)\n File \"/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/datetime/datetime_parser.py\", line 29, in parse\n parsed_datetime = datetime.datetime.strptime(str(date), format)\n File \"/usr/local/lib/python3.9/_strptime.py\", line 568, in _strptime_datetime\n tt, fraction, gmtoff_fraction = _strptime(data_string, format)\n File \"/usr/local/lib/python3.9/_strptime.py\", line 349, in _strptime\n raise ValueError(\"time data %r does not match format %r\" %\nValueError: time data '' does not match format '%Y-%m-%dT%H:%M:%SZ'\n"}}

{"type": "LOG", "log": {"level": "ERROR", "message": "Check failed"}}

{"type": "CONNECTION_STATUS", "connectionStatus": {"status": "FAILED", "message": "\"Unable to connect to stream events - time data '' does not match format '%Y-%m-%dT%H:%M:%SZ'\""}}

@btkcodedev
Copy link
Collaborator Author

btkcodedev commented Aug 15, 2023

@sajarin
Updated the start date for solving #27385,

Please update the secrets config to match the updated format (start_date: %Y-%m-%dT%H:%M:%SZ)
Ping via Slack (btkcodedev) for getting my creds if needed

@sajarin
Copy link
Contributor

sajarin commented Aug 15, 2023

@btkcodedev thanks for the update, config validation is now passing but no records are being fetched. I pinged you on slack for credentials so we can get this moving.

@sajarin sajarin merged commit 359d846 into airbytehq:master Aug 17, 2023
34 of 41 checks passed
@sajarin
Copy link
Contributor

sajarin commented Aug 17, 2023

Thanks for the contribution @btkcodedev!

@padala
Copy link

padala commented Aug 21, 2023

@btkcodedev @sajarin Thanks for the contribution. I'm still facing the issue with sync resulting in 0 records when I tried this today on Airbyte Cloud. Is this already resolved?

@btkcodedev thanks for the update, config validation is now passing but no records are being fetched. I pinged you on slack for credentials so we can get this moving.

@sajarin
Copy link
Contributor

sajarin commented Aug 21, 2023

@padala can you make a new issue and tag me? Perhaps an issue with the record selector

harrytou pushed a commit to KYVENetwork/airbyte that referenced this pull request Sep 1, 2023
Co-authored-by: Marcos Marx <marcosmarxm@users.noreply.github.com>
Co-authored-by: Sajarin <sajarindider@gmail.com>
@padala
Copy link

padala commented Sep 1, 2023

@sajarin I've created a new issues here - #30105

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 connectors/source/mailgun Hackathon External low-code/ui connector builder hackathons hackathon-2023-08 team/tse Technical Support Engineers
Projects
Development

Successfully merging this pull request may close these issues.

mailgun
5 participants