-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Feature][Connector-V2][JDBC] support sqlite Source & Sink #3089
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
04e2395
refactor JDBC[SqLite] connector
nutsjian cf1ddc4
[Improve] [JDBC] [SQLite] Connector test more field types
nutsjian 2981c1a
add [JDBC] [SQLite] doc
nutsjian 0643e4a
fix [JDBC] [SQLite] e2e test case method name
nutsjian f3de959
[fix] class name error
nutsjian 6f3b792
[Hotfix] [JDBC] [SQLite] connector e2e test path problem
nutsjian e4bf558
[fix] [JDBC] [SQLite] flink e2e test docker container db file cannot …
nutsjian 45701f3
[fix] [JDBC] [SQLite] flink e2e test
nutsjian 7bd5125
Merge branch 'dev' into jdbc-sqlite
nutsjian e587104
[fix] [JDBC] [SQLite] flink e2e test database closed error
nutsjian 049f6c7
Merge branch 'dev' into jdbc-sqlite
nutsjian 803dec9
Merge branch 'dev' into jdbc-sqlite
nutsjian ce5ddf0
[fix] [JDBC] [SQLite] e2e test, rerun workflows commit
nutsjian eb321b0
Merge branch 'dev' into jdbc-sqlite
nutsjian 0118847
update [JDBC] [SQLite] add change log
nutsjian 7ef5bfe
Merge branch 'dev' into jdbc-sqlite
nutsjian d5ed310
update [JDBC] [SQLite] change log doc
nutsjian a861767
update [JDBC] [SQLite] connector map tinyint smallint to SeaTunnel Sh…
nutsjian 8fbaad8
refactor JDBC[SqLite] connector
nutsjian dfd660c
Merge branch 'dev' into jdbc-sqlite
nutsjian 93468b5
update, merge upstream dev, add e2e in flink/spark e2e module so that…
nutsjian 18cf506
update checkstyle
nutsjian 70494ae
Merge branch 'dev' into jdbc-sqlite
nutsjian 03fba9f
[checkstyle] remove unused import
nutsjian 976c5a6
Merge remote-tracking branch 'upstream' into jdbc-sqlite
nutsjian 6197196
Merge branch 'dev' of https://github.com/apache/incubator-seatunnel i…
nutsjian d03bf4d
update [JDBC] [SQLite] connector
nutsjian 5ad4b4c
Merge branch 'dev' into jdbc-sqlite
nutsjian fa00b72
Merge branch 'dev' into jdbc-sqlite
nutsjian 5c0b7e8
Merge branch 'dev' into jdbc-sqlite
nutsjian f4d4d33
fix [JDBC] [SQLite] connector, remove root pom.xml dup net.alchim31.m…
nutsjian 3204610
update [Connector] [JDBC] SQLite, remove typeAffinity option, impleme…
nutsjian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/sqlite/SqliteDialect.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.sqlite; | ||
|
||
import org.apache.seatunnel.connectors.seatunnel.jdbc.internal.converter.JdbcRowConverter; | ||
import org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.JdbcDialect; | ||
import org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.JdbcDialectTypeMapper; | ||
|
||
import java.util.Arrays; | ||
import java.util.Optional; | ||
import java.util.stream.Collectors; | ||
|
||
public class SqliteDialect implements JdbcDialect { | ||
@Override | ||
public String dialectName() { | ||
return "Sqlite"; | ||
} | ||
|
||
@Override | ||
public JdbcRowConverter getRowConverter() { | ||
return new SqliteJdbcRowConverter(); | ||
} | ||
|
||
@Override | ||
public JdbcDialectTypeMapper getJdbcDialectTypeMapper() { | ||
return new SqliteTypeMapper(); | ||
} | ||
|
||
@Override | ||
public String quoteIdentifier(String identifier) { | ||
return "`" + identifier + "`"; | ||
} | ||
|
||
@Override | ||
public Optional<String> getUpsertStatement(String tableName, String[] fieldNames, String[] uniqueKeyFields) { | ||
String updateClause = Arrays.stream(fieldNames) | ||
.map(fieldName -> quoteIdentifier(fieldName) + "=VALUES(" + quoteIdentifier(fieldName) + ")") | ||
.collect(Collectors.joining(", ")); | ||
|
||
String conflictFields = Arrays.stream(uniqueKeyFields) | ||
.map(this::quoteIdentifier) | ||
.collect(Collectors.joining(",")); | ||
|
||
String upsertSQL = getInsertIntoStatement(tableName, fieldNames) + " ON CONFLICT(" + conflictFields + ") DO UPDATE SET " + updateClause; | ||
return Optional.of(upsertSQL); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...che/seatunnel/connectors/seatunnel/jdbc/internal/dialect/sqlite/SqliteDialectFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.sqlite; | ||
|
||
import org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.JdbcDialect; | ||
import org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.JdbcDialectFactory; | ||
|
||
import com.google.auto.service.AutoService; | ||
|
||
/** | ||
* Factory for {@link SqliteDialect}. | ||
*/ | ||
|
||
@AutoService(JdbcDialectFactory.class) | ||
public class SqliteDialectFactory implements JdbcDialectFactory { | ||
@Override | ||
public boolean acceptsURL(String url) { | ||
return url.startsWith("jdbc:sqlite:"); | ||
} | ||
|
||
@Override | ||
public JdbcDialect create() { | ||
return new SqliteDialect(); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...e/seatunnel/connectors/seatunnel/jdbc/internal/dialect/sqlite/SqliteJdbcRowConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.sqlite; | ||
|
||
import org.apache.seatunnel.connectors.seatunnel.jdbc.internal.converter.AbstractJdbcRowConverter; | ||
|
||
public class SqliteJdbcRowConverter extends AbstractJdbcRowConverter { | ||
|
||
@Override | ||
public String converterName() { | ||
return "Sqlite"; | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Please revert it.