Skip to content

MySql Source: Fix data processing - #6093

Merged
Andrii Leonets (DoNotPanicUA) merged 26 commits into
masterfrom
aleonets/3931-3932-fix-mysql
Oct 12, 2021
Merged

MySql Source: Fix data processing#6093
Andrii Leonets (DoNotPanicUA) merged 26 commits into
masterfrom
aleonets/3931-3932-fix-mysql

Conversation

@DoNotPanicUA

@DoNotPanicUA Andrii Leonets (DoNotPanicUA) commented Sep 15, 2021

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added the area/connectors Connector related issues label Sep 15, 2021
@DoNotPanicUA Andrii Leonets (DoNotPanicUA) changed the title MySql Source: Fix data processing 🐛 MySql Source: Fix data processing Sep 17, 2021
@DoNotPanicUA Andrii Leonets (DoNotPanicUA) changed the title 🐛 MySql Source: Fix data processing bug MySql Source: Fix data processing Sep 17, 2021
@DoNotPanicUA Andrii Leonets (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
@sherifnada

Copy link
Copy Markdown
Contributor

Andrii Leonets (@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
Andrii Leonets (DoNotPanicUA) temporarily deployed to more-secrets September 23, 2021 12:25 Inactive
@alexandr-shegeda
Oleksandr Sheheda (alexandr-shegeda) temporarily deployed to more-secrets October 6, 2021 12:37 Inactive
@alexandr-shegeda
Oleksandr Sheheda (alexandr-shegeda) temporarily deployed to more-secrets October 11, 2021 15:04 Inactive
…fix-mysql

# Conflicts:
#	docs/integrations/sources/mysql.md
@DoNotPanicUA
Andrii Leonets (DoNotPanicUA) temporarily deployed to more-secrets October 11, 2021 19:19 Inactive
@DoNotPanicUA
Andrii Leonets (DoNotPanicUA) temporarily deployed to more-secrets October 11, 2021 19:57 Inactive
@DoNotPanicUA

Andrii Leonets (DoNotPanicUA) commented Oct 11, 2021

Copy link
Copy Markdown
Contributor Author

/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
Jared Rhizor (jrhizor) temporarily deployed to more-secrets October 11, 2021 20:01 Inactive
Comment thread docs/integrations/sources/mysql.md Outdated
config.get("port").asText(),
config.get("database").asText()));

jdbcUrl.append("?zeroDateTimeBehavior=convertToNull");

Copy link
Copy Markdown
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

.airbyteType(JsonSchemaPrimitive.NUMBER)
.addInsertValues("null")
.addNullExpectedValue()
.addInsertValues("null", "10.5")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sounds good, thanks!

…a/io/airbyte/integrations/destination/mysql/MySQLDestination.java

Co-authored-by: Sherif A. Nada <snadalive@gmail.com>
Co-authored-by: Sherif A. Nada <snadalive@gmail.com>
@DoNotPanicUA
Andrii Leonets (DoNotPanicUA) temporarily deployed to more-secrets October 12, 2021 11:41 Inactive
@DoNotPanicUA
Andrii Leonets (DoNotPanicUA) temporarily deployed to more-secrets October 12, 2021 12:56 Inactive
@DoNotPanicUA
Andrii Leonets (DoNotPanicUA) temporarily deployed to more-secrets October 12, 2021 14:40 Inactive
@DoNotPanicUA

Andrii Leonets (DoNotPanicUA) commented Oct 12, 2021

Copy link
Copy Markdown
Contributor Author

/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
Jared Rhizor (jrhizor) temporarily deployed to more-secrets October 12, 2021 14:43 Inactive
@DoNotPanicUA
Andrii Leonets (DoNotPanicUA) deleted the aleonets/3931-3932-fix-mysql branch October 12, 2021 15:08
Konrad Schlatte (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 <snadalive@gmail.com>

* Update docs/integrations/sources/mysql.md

Co-authored-by: Sherif A. Nada <snadalive@gmail.com>

* add back comments to the data type mapping

* incr config version

Co-authored-by: Oleksandr Sheheda <alexandrshegeda@gmail.com>
Co-authored-by: Sherif A. Nada <snadalive@gmail.com>
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.

Source MySQL: Connector provides wrong values for some datatypes Source MySQL: Connector fails if source contains "tricky" date values

6 participants