Skip to content

Commit

Permalink
Change JDBC ClickHouse version into 0.3.2-patch9 (#13639)
Browse files Browse the repository at this point in the history
* change jdbc clickhoue verstion into 0.3.2-patch9

* running query by query & changing Docker version

Co-authored-by: mzitnik <mark.zitnik@clickhouse.com>
  • Loading branch information
2 people authored and mfsiega-airbyte committed Jul 21, 2022
1 parent 7766695 commit 4e9f287
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
public enum DatabaseDriver {

CLICKHOUSE("ru.yandex.clickhouse.ClickHouseDriver", "jdbc:clickhouse://%s:%d/%s"),
CLICKHOUSE("com.clickhouse.jdbc.ClickHouseDriver", "jdbc:clickhouse://%s:%d/%s"),
DATABRICKS("com.databricks.client.jdbc.Driver", "jdbc:databricks://%s;HttpPath=%s;UserAgentEntry=Airbyte"),
DB2("com.ibm.db2.jcc.DB2Driver", "jdbc:db2://%s:%d/%s"),
MARIADB("org.mariadb.jdbc.Driver", "jdbc:mariadb://%s:%d/%s"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ ENV APPLICATION destination-clickhouse

COPY --from=build /airbyte /airbyte

LABEL io.airbyte.version=0.1.8
LABEL io.airbyte.version=0.1.9
LABEL io.airbyte.name=airbyte/destination-clickhouse
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies {
implementation files(project(':airbyte-integrations:bases:base-java').airbyteDocker.outputs)

// https://mvnrepository.com/artifact/ru.yandex.clickhouse/clickhouse-jdbc
implementation 'ru.yandex.clickhouse:clickhouse-jdbc:0.3.1-patch'
implementation group: 'com.clickhouse', name: 'clickhouse-jdbc', version: '0.3.2-patch9'

// https://mvnrepository.com/artifact/org.testcontainers/clickhouse
testImplementation libs.connectors.destination.testcontainers.clickhouse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.yandex.clickhouse.ClickHouseConnection;
import ru.yandex.clickhouse.ClickHouseStatement;
import ru.yandex.clickhouse.domain.ClickHouseFormat;
import com.clickhouse.jdbc.ClickHouseConnection;
import com.clickhouse.jdbc.ClickHouseStatement;
import com.clickhouse.client.ClickHouseFormat;

public class ClickhouseSqlOperations extends JdbcSqlOperations {

Expand Down Expand Up @@ -52,11 +52,10 @@ public String createTableQuery(final JdbcDatabase database, final String schemaN

@Override
public void executeTransaction(final JdbcDatabase database, final List<String> queries) throws Exception {
final StringBuilder appendedQueries = new StringBuilder();
// Note: ClickHouse does not support multi query
for (final String query : queries) {
appendedQueries.append(query);
database.execute(query);
}
database.execute(appendedQueries.toString());
}

@Override
Expand All @@ -82,7 +81,8 @@ public void insertRecordsInternal(final JdbcDatabase database,
ClickHouseStatement sth = conn.createStatement();
sth.write() // Write API entrypoint
.table(String.format("%s.%s", schemaName, tmpTableName)) // where to write data
.data(tmpFile, ClickHouseFormat.CSV) // specify input
.format(ClickHouseFormat.CSV) // set a format
.data(tmpFile.getAbsolutePath()) // specify input
.send();

} catch (final Exception e) {
Expand Down

0 comments on commit 4e9f287

Please sign in to comment.