-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
🎉 Source MySQL: support all MySQL 8.0 types #7970
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.
I like it! Great direction
.../src/test-integration/java/io/airbyte/integrations/source/mysql/MySqlSourceDatatypeTest.java
Outdated
Show resolved
Hide resolved
cf5e44f
to
3f675b2
Compare
809be96
to
55a5499
Compare
@sherifnada, @etsybaev, @DoNotPanicUA, this PR is ready for review. Would you mind taking a look? |
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 quite impressive!
* fail it, so it is turned off by default. It should be enabled for all databases eventually. | ||
*/ | ||
protected boolean testCatalog() { | ||
return false; |
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.
Is that expected to be committed or just accidentally forgotten?
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.
same comment
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 is expected. See the comment for the rationale. We need to check each database because we can turn it on by default.
* fail it, so it is turned off by default. It should be enabled for all databases eventually. | ||
*/ | ||
protected boolean testCatalog() { | ||
return false; |
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.
same comment
@@ -97,9 +97,4 @@ public static void main(final String[] args) throws Exception { | |||
LOGGER.info("completed source: {}", CockroachDbSource.class); | |||
} | |||
|
|||
@Override | |||
protected JdbcSourceOperations getSourceOperations() { |
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.
how come this was removed? is the class still useful?
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 method is unnecessary. The sourceOperations
is an instance variable, and it is assigned in the constructor. The AbstractJdbcSource
can just reference that variable.
case TIME -> putTime(json, columnName, resultSet, colIndex); | ||
// The returned year value can either be a java.sql.Short (when yearIsDateType=false) | ||
// or a java.sql.Date with the date set to January 1st, at midnight (when yearIsDateType=true). | ||
// Currently, JsonSchemaPrimitive does not support integer, but only supports number. |
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.
seems like fixing up jsonSchemaPrimitive is high up on the list of things to fix also?
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.
Added an issue: #8722
* does not contain information about its charset, which is needed to determine whether the column | ||
* is a string or binary. We don't distinguish between string vs binary in | ||
* {@link JsonSchemaPrimitive} for now. So it is fine. However, in the future, if we want to | ||
* separate these two types, we need to update the column metadata query for MySQL. See |
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.
should we have an issue for this?
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.
Added an issue: #8723
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.
Actually JDBC does return BINARY
for CHAR
columns with binary
character set. Same for VARCHAR
. So this is a false alarm.
.fullSourceDataType("varchar(256) character set cp1251") | ||
.addInsertValues("null", "'тест'") | ||
.addExpectedValues(null, "тест") | ||
// MySQL converts values in the ranges '0' - '69' to YEAR value in the range 2000 - 2069 |
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.
what on earth...
/test connector=connectors/source-mysql
|
/test connector=connectors/source-mysql
|
/publish connector=connectors/source-mysql
|
* Add jdbc compatible layer * Support routine mysql types * Format code * Fix build * Refactor abstract jdbc source and operation classes * Update mysql source operations * Test discover command for mysql * Remove abstract jdbc compatible source layer * Format code * Update template * Fix more types * Bump version * Log original field type * Update comments * Bump version in seed
What
0.5.0
.How
AbstractJdbcSource
is changed to a generic class.JdbcCompatibleSourceOperations
interface is added that extends fromSourceOperations
. It has more interface methods to be used inAbstractJdbcSource
.JdbcSourceOperations
is broken into two classes:AbstractJdbcCompatibleSourceOperations
has most of the original logics with generic types.JdbcSourceOperations
extends fromAbstractJdbcCompatibleSourceOperations
with theJDBCTypes
.MySqlSourceOperations
extends fromAbstractJdbcCompatibleSourceOperations
with theMysqlType
.TODOs
MysqlType
in all methods.Recommended reading order
MySqlSourceOperations.java
Pre-Merge Checklist - Updating Connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampleAirbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing./publish
command described here