-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
🐛 Destination MySQL: fix problem with data containing nested JSON #4664
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @julianopiovezan! LGTM to me, @subodh1810 can you validate it too?
@julianopiovezan I also create #4671 to insert a unit test to validate and ensure this problem doesnt happen again for all jdbc-destination connector |
Also already create PR #4671 to test and bump version of this modification. |
Nice, thanks @marcosmarxm. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine. It would be great if we can add a test case for this
I also encountered the same problem, I hope I can help solve it as soon as possible, thank you |
Hope that will be fixed as part of #4825 |
Hi @marcosmarxm this PR has been created 10 days ago, but probably author doesn't have time to finish it. My PR contains both fix, test and it's based on the latest master. I also have a bumped versions. So I would rather cancel this PR and merge it all at one shot to have a git history consistent (in my PR). What do you think? |
@etsybaev could we merge this and you pull master/solve conflicts in your side? |
Hi @marcosmarxm. My PR with the fix, test and bumped versions was merged to master 2 days ago.#4825 |
@julianopiovezan thanks a lot for the contribution and guide the solution for the problem. I'm closing your PR because #4825 add tests to the problem. Hope for future contributions! |
Sure, no problem @marcosmarxm. I'm glad to help. |
What
Fix #4583.
How
When a source has a text field containing a JSON, the double quotes of this field in the AirbyteRecordMessage must be escaped with a backslash, following the spec.
Here is a sample of a temp file created by writeBatchToFile
ee9e9984-083a-439b-8a1d-f9178181fb01,"{""id"":1,""topic"":""install"",""timestamp"":""2017-08-22T17:22:15Z"",""model"":""install"",""details"":""{\""name\"":\""Conferência Faturamento - Custo - Taxas - Margem - Resumo ano inicial até -2\"",\""description\"":null}""}",2021-07-08 00:58:59.889
The proposed solution is to use the ESCAPED BY clause of the MySQL LOAD DATA statement so the sequence
\"
will be treated as part of the field value.Recommended reading order
x.java
y.python
Pre-merge Checklist
Expand the checklist which is relevant for this PR.
Connector checklist
airbyte_secret
in the connector's spec./gradlew :airbyte-integrations:connectors:<name>:integrationTest
./test connector=connectors/<name>
command as documented here is passing.README.md
docs/SUMMARY.md
if it's a new connectordocs/integrations/<source or destination>/<name>
.docs/integrations/...
. See changelog exampledocs/integrations/README.md
contains a reference to the new connector/publish
command described hereConnector Generator checklist
-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