Skip to content

🎉 Destination MySQL: Add jdbc_url_params support for optional JDBC parameters #10362

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

Merged
merged 30 commits into from
Feb 17, 2022

Conversation

girarda
Copy link
Contributor

@girarda girarda commented Feb 15, 2022

What

Add support for MySQL Destinations to take in a JDBC URL Params input to specify any additional JDBC parameters for the connection

How

Add in jdbc_url_params for MySQLDestination in the config JsonNode. Optionally append to the JDBC string if it exists and is not empty.

Recommended reading order

  1. Updated MySQL destination spec: airbyte-integrations/connectors/destination-mysql/src/main/resources/spec.json
  2. Updated implementation: airbyte-integrations/connectors/destination-mysql/src/main/java/io/airbyte/integrations/destination/mysql/MySQLDestination.java
  3. Unit tests: airbyte-integrations/connectors/destination-mysql/src/test/java/io/airbyte/integrations/destination/mysql/MySQLDestinationTest.java

🚨 User Impact 🚨

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
  • 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
  • Credentials added to Github CI. 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

@CLAassistant
Copy link

CLAassistant commented Feb 15, 2022

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the area/connectors Connector related issues label Feb 15, 2022
@girarda girarda changed the title Alex/mysql jdbc params Destination MySQL: Add jdbc_url_params support for optional JDBC parameters Feb 15, 2022
@girarda girarda temporarily deployed to more-secrets February 15, 2022 23:14 Inactive
@girarda girarda temporarily deployed to more-secrets February 15, 2022 23:14 Inactive
@girarda girarda temporarily deployed to more-secrets February 15, 2022 23:17 Inactive
@girarda girarda temporarily deployed to more-secrets February 15, 2022 23:17 Inactive
@girarda girarda temporarily deployed to more-secrets February 15, 2022 23:25 Inactive
@girarda girarda temporarily deployed to more-secrets February 15, 2022 23:25 Inactive
@girarda girarda marked this pull request as draft February 16, 2022 00:13
@girarda girarda temporarily deployed to more-secrets February 16, 2022 01:27 Inactive
@girarda girarda temporarily deployed to more-secrets February 16, 2022 01:27 Inactive
@girarda girarda temporarily deployed to more-secrets February 16, 2022 01:29 Inactive
@girarda girarda temporarily deployed to more-secrets February 16, 2022 01:29 Inactive
if (!additionalParameters.isEmpty()) {
jdbcUrl.append("&");
jdbcUrl.append("?");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

append "?" instead of "&" since this zeroDateTimeBehavior=convertToNull is already included in additionalParameters

@girarda girarda temporarily deployed to more-secrets February 16, 2022 23:40 Inactive
@girarda girarda temporarily deployed to more-secrets February 16, 2022 23:40 Inactive
@tuliren
Copy link
Contributor

tuliren commented Feb 16, 2022

@tuliren should this be throwing a more concrete exception type?

Oh, I missed this question during the review. Yes, I think the IllegalArgumentException is better for this case.

Copy link
Contributor

@tuliren tuliren left a comment

Choose a reason for hiding this comment

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

Thanks for the updates. I think the only thing left is to replace RuntimeException with a more specific one, like IllegalArgumentException. Next you can publish a new version of this connector, update the version in the seed, and update the spec. You can follow the pre-merge checklist for details.

@girarda girarda temporarily deployed to more-secrets February 17, 2022 00:19 Inactive
@girarda girarda temporarily deployed to more-secrets February 17, 2022 00:19 Inactive
@girarda girarda temporarily deployed to more-secrets February 17, 2022 00:29 Inactive
@girarda girarda temporarily deployed to more-secrets February 17, 2022 00:29 Inactive
@girarda
Copy link
Contributor Author

girarda commented Feb 17, 2022

/test connector=connectors/destination-mysql

🕑 connectors/destination-mysql https://github.com/airbytehq/airbyte/actions/runs/1856011375
✅ connectors/destination-mysql https://github.com/airbytehq/airbyte/actions/runs/1856011375
Python tests coverage:

Name                                                                                                                            Stmts   Miss  Cover
---------------------------------------------------------------------------------------------------------------------------------------------------
/actions-runner/_work/airbyte/airbyte/airbyte-integrations/bases/airbyte-protocol/airbyte_protocol/__init__.py                      2      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/models/airbyte_protocol.py     124      0   100%
normalization/__init__.py                                                                                                           4      0   100%
normalization/destination_type.py                                                                                                  13      0   100%
normalization/transform_catalog/__init__.py                                                                                         2      0   100%
normalization/transform_catalog/catalog_processor.py                                                                              143     77    46%
normalization/transform_catalog/destination_name_transformer.py                                                                   155      8    95%
normalization/transform_catalog/reserved_keywords.py                                                                               13      0   100%
normalization/transform_catalog/stream_processor.py                                                                               520    333    36%
normalization/transform_catalog/table_name_registry.py                                                                            174     34    80%
normalization/transform_catalog/transform.py                                                                                       45     26    42%
normalization/transform_catalog/utils.py                                                                                           33      7    79%
normalization/transform_config/__init__.py                                                                                          2      0   100%
normalization/transform_config/transform.py                                                                                       148     34    77%
---------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                                                                                            1379    519    62%

@octavia-squidington-iii octavia-squidington-iii temporarily deployed to more-secrets February 17, 2022 00:35 Inactive
@girarda girarda changed the title Destination MySQL: Add jdbc_url_params support for optional JDBC parameters 🎉 Destination MySQL: Add jdbc_url_params support for optional JDBC parameters Feb 17, 2022
@girarda girarda linked an issue Feb 17, 2022 that may be closed by this pull request
@girarda
Copy link
Contributor Author

girarda commented Feb 17, 2022

/publish connector=connectors/destination-mysql

🕑 connectors/destination-mysql https://github.com/airbytehq/airbyte/actions/runs/1856175865
✅ connectors/destination-mysql https://github.com/airbytehq/airbyte/actions/runs/1856175865

@octavia-squidington-iii octavia-squidington-iii temporarily deployed to more-secrets February 17, 2022 01:23 Inactive
@girarda girarda temporarily deployed to more-secrets February 17, 2022 02:03 Inactive
@girarda girarda temporarily deployed to more-secrets February 17, 2022 02:03 Inactive
@girarda girarda merged commit 3db3e88 into master Feb 17, 2022
@girarda girarda deleted the alex/mysql-jdbc-params branch February 17, 2022 18:58
@girarda girarda restored the alex/mysql-jdbc-params branch February 18, 2022 23:29
@girarda girarda temporarily deployed to more-secrets February 18, 2022 23:31 Inactive
@girarda girarda temporarily deployed to more-secrets February 18, 2022 23:31 Inactive
@octavia-squidington-iii octavia-squidington-iii temporarily deployed to more-secrets February 18, 2022 23:32 Inactive
@octavia-squidington-iii octavia-squidington-iii temporarily deployed to more-secrets February 19, 2022 00:17 Inactive
@girarda girarda deleted the alex/mysql-jdbc-params branch February 19, 2022 00:48
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Destination MySQL: custom JDBC parameters
4 participants