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

MySql Source: Fix data processing #6093

Merged
merged 26 commits into from
Oct 12, 2021
Merged

Conversation

DoNotPanicUA
Copy link
Contributor

@DoNotPanicUA DoNotPanicUA commented Sep 15, 2021

What

Fix MySql source fails and wrong data type handlers.

Note that some cases are still relevant as driver restriction or another issue:

  1. Zero-date values are not allowed for the JDBC drivers
  2. CDC process the bool MySQL type as a common boolean logic (>0 -> true). Debezium driver has an issue that prevents the implementation of a handler for the bool type. (Bool field treat as an int in the Debezium handler. As result you are not able to identify that you are processing bool type)
  3. Default MySql (non-CDC) has an issue with processing Binary values. MySql source : source binary node transforms to text node  #5878

How

Implement MySql specific handlers for problem data types

Recommended reading order

  1. MySQLConverter.java - CDC
  2. MySqlSourceOperations.java - Common
  3. mysql.md - restrictions

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
  • Connector added to connector index like described here

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

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
  • Connector version bumped like described here

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

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.

@DoNotPanicUA DoNotPanicUA self-assigned this Sep 15, 2021
@github-actions github-actions bot added the area/connectors Connector related issues label Sep 15, 2021
@DoNotPanicUA DoNotPanicUA changed the title MySql Source: Fix data processing 🐛 MySql Source: Fix data processing Sep 17, 2021
@DoNotPanicUA DoNotPanicUA changed the title 🐛 MySql Source: Fix data processing bug MySql Source: Fix data processing Sep 17, 2021
@DoNotPanicUA DoNotPanicUA changed the title bug MySql Source: Fix data processing MySql Source: Fix data processing Sep 17, 2021
@github-actions github-actions bot added the area/documentation Improvements or additions to documentation label Sep 17, 2021
@DoNotPanicUA DoNotPanicUA marked this pull request as ready for review September 21, 2021 13:02
@sherifnada
Copy link
Contributor

@DoNotPanicUA I won't be able to get to this for 1 or 2 days, my apologies. Will leave a review in a couple of days

@DoNotPanicUA DoNotPanicUA temporarily deployed to more-secrets September 23, 2021 12:25 Inactive
@alexandr-shegeda alexandr-shegeda temporarily deployed to more-secrets October 6, 2021 12:37 Inactive
@alexandr-shegeda alexandr-shegeda temporarily deployed to more-secrets October 11, 2021 15:04 Inactive
…fix-mysql

# Conflicts:
#	docs/integrations/sources/mysql.md
@DoNotPanicUA DoNotPanicUA temporarily deployed to more-secrets October 11, 2021 19:19 Inactive
@DoNotPanicUA DoNotPanicUA temporarily deployed to more-secrets October 11, 2021 19:57 Inactive
@DoNotPanicUA
Copy link
Contributor Author

DoNotPanicUA commented Oct 11, 2021

/test connector=source-mysql

🕑 source-mysql https://github.com/airbytehq/airbyte/actions/runs/1330391161
✅ source-mysql https://github.com/airbytehq/airbyte/actions/runs/1330391161
No Python unittests run

@jrhizor jrhizor temporarily deployed to more-secrets October 11, 2021 20:01 Inactive
docs/integrations/sources/mysql.md Outdated Show resolved Hide resolved
@@ -87,8 +87,9 @@ public JsonNode toJdbcConfig(JsonNode config) {
config.get("port").asText(),
config.get("database").asText()));

jdbcUrl.append("?zeroDateTimeBehavior=convertToNull");
Copy link
Contributor

Choose a reason for hiding this comment

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

we should add a note in the .md docs saying that zero date time is converted to null

@@ -175,16 +176,16 @@ protected void initTests() {
TestDataHolder.builder()
.sourceType("float")
.airbyteType(JsonSchemaPrimitive.NUMBER)
.addInsertValues("null")
.addNullExpectedValue()
.addInsertValues("null", "10.5")
Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good, thanks!

DoNotPanicUA and others added 2 commits October 12, 2021 14:38
…a/io/airbyte/integrations/destination/mysql/MySQLDestination.java

Co-authored-by: Sherif A. Nada <[email protected]>
@DoNotPanicUA DoNotPanicUA temporarily deployed to more-secrets October 12, 2021 11:41 Inactive
@DoNotPanicUA DoNotPanicUA temporarily deployed to more-secrets October 12, 2021 12:56 Inactive
@DoNotPanicUA DoNotPanicUA temporarily deployed to more-secrets October 12, 2021 14:40 Inactive
@DoNotPanicUA
Copy link
Contributor Author

DoNotPanicUA commented Oct 12, 2021

/publish connector=connectors/source-mysql

🕑 connectors/source-mysql https://github.com/airbytehq/airbyte/actions/runs/1333585494
✅ connectors/source-mysql https://github.com/airbytehq/airbyte/actions/runs/1333585494

@jrhizor jrhizor temporarily deployed to more-secrets October 12, 2021 14:43 Inactive
@DoNotPanicUA DoNotPanicUA merged commit a98b3fe into master Oct 12, 2021
@DoNotPanicUA DoNotPanicUA deleted the aleonets/3931-3932-fix-mysql branch October 12, 2021 15:08
schlattk pushed a commit to schlattk/airbyte that referenced this pull request Jan 4, 2022
* move logic from static JdbcUtils to JdbcSourceOperations

* format

* Add methods for all types in order to have possibility rewrite them and use common type mapping.

* Make BigQuery in line impl with JDBC changes

* fix binary type

* add database creations methods with sourceOperations input

* add MySqlSourceOperations

* fix processing

* Fix CDC processing

* format

* add some tests for double and float

* incr version

* airbytehq#3931 airbytehq#3932 added zero-date converting to null param "zeroDateTimeBehavior=convertToNull"

* remove old tests covered by data type tests + incr ver

* Update airbyte-integrations/connectors/destination-mysql/src/main/java/io/airbyte/integrations/destination/mysql/MySQLDestination.java

Co-authored-by: Sherif A. Nada <[email protected]>

* Update docs/integrations/sources/mysql.md

Co-authored-by: Sherif A. Nada <[email protected]>

* add back comments to the data type mapping

* incr config version

Co-authored-by: Oleksandr Sheheda <[email protected]>
Co-authored-by: Sherif A. Nada <[email protected]>
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
6 participants