-
Notifications
You must be signed in to change notification settings - Fork 89
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
Fix NString value to JSON #341
Fix NString value to JSON #341
Conversation
@dmikurube @hiroyuki-sato |
@@ -61,6 +61,6 @@ public void timestampValue(final Instant v) throws IOException, SQLException | |||
@Override | |||
public void jsonValue(Value v) throws IOException, SQLException | |||
{ | |||
defaultValue.setNString(); | |||
batch.setNString(v.toJson()); |
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.
Mainly for compatibility with the following changes.
https://github.com/embulk/embulk-output-jdbc/pull/320/files
Hello, @t3t5u Thank you for your comment. Just to double-check, please allow me to confirm. This PR fixes if input data contains JSON data and uses column type
example config out:
type: sqlserver
column_options:
my_col_1: {type: 'NVARCHAR'}
@dmikurube, @hito4t Please take a look when you get a chance. |
@t3t5u Setting a JSON value into a stringified NString sounds basically more reasonable than setting a JSON value always into null NString, but what we are always concerned are about :
Just making a small change can easily cause an incompatibility like you experienced in #320 as shown here. #320 looked compatible enough, but it was actually not. Please confirm more with (try iterating over) possible combinations of input Embulk data types x output RDB data types x JDBC driver types. |
Thank you for your response.
This understanding is correct.
Okay. But please give me some time. |
The following is the results of the confirmation. First, NCHAR or NVARCHAR has no meaning in MySQL, PostgreSQL, Redshift, Oracle, or Db2, only in SQL Server. Even if syntactically available, NCHAR or NVARCHAR is essentially Unicode-restricted CHAR or VARCHAR, and as far as I can find out, there is no type that maps to References:
And I have confirmed MySQL, PostgreSQL, Redshift, and SQL Server using the following scripts. Please confirm the results. |
@t3t5u Thank you for your work. Can you show us the test results just in case? I read this file change. but It doesn't contain test results. |
Added raw result logs (credentials are masked). Thank you. |
Hello, @t3t5u Thank you for your work. Questions
I confirmed that all of test results are complete the same this description. Inputinput data1
input data2
Test MySQL(default,8.3.0), PostgreSQL(default,42.7.3) and Redshiftinput data1
input data2
SQL Serverinput data1
input data2
|
Since early versions, if Before #320, if
Updated test scripts & logs. In summary,
I don't think this scrips are suitable for use in CI.
I think it should only be used as a reference. |
Hello, @t3t5u I confirmed this fix looking good for me. 👍 @dmikurube , @hito4t Please take a look when you get a chance. Inptut datainput data1
input data2
input data3
input data4
MySQL, PostgreSQL, Redshift
input data2
input data3
input data4
SQL Server
input data2
input data3
input data4
|
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.
Sorry to be late, and thanks for the great investigations, @t3t5u, and summarizing them, also @hiroyuki-sato !
Finally it looks good to me! Let me merge this, and release a next version. (It'd be simply v0.10.6 as it's a "fix".)
Cc'ing: @hito4t, but I guess he would be okay with it.
Apart from this change by itself, we're still so happy if you could consider contributing :
- These tests into this repo somehow
- No need to be right now, which can be in another pull request, weeks/months later
- No need to be runnable as-is in CI immediately, but just manual test script(s) would help
- Just the idea to test it is still helpful for later
- A quick document about the relations of types that you confirmed
- Not just in this pull request discussion, but nice to have it as a part of this repo
- Such a document would be in Markdown under
embulk-output-jdbc/docs/
- If you have any hesitation about, for example, ex. documenting, English, format, ..., I could help about that
The JDBC plugins are much historical, and we have just very little information about these. Any tests and documents would help!
Merging... |
I also think the new specification is desirable. 👍 |
Fix NString value to JSON same as StringColumnSetter.