clickhouse-java icon indicating copy to clipboard operation
clickhouse-java copied to clipboard

sendRowBinaryStream is not available in last version

Open filimonov opened this issue 3 years ago • 1 comments

Mikhail Filimonov, [13.04.2022 14:48] Hello :) In newer api the sendRowBinaryStream function is missing. Is there some alternative way to send RowBinary to ClickHouse? Do you have some example of that?

Zhichun Wu, [13.04.2022 14:49] Actually, the new driver uses RowBinary by default, so people do not have to use legacy API to deal with a binary stream

Mikhail Filimonov, [13.04.2022 14:50] Sounds good :) And is there an example of bulk loading of the data similar to sendRowBinaryStream ? Maybe in some of the tests?

Zhichun Wu, [13.04.2022 14:50] And in Java clients, they should be able to use

clickhouseClient.connect(clickhouseNode).format(ClickHouseFormat.RowBinary).write().table("mytable").data(<input stream here>).send()

Zhichun Wu, [13.04.2022 14:53] Yes, there are a few examples at https://github.com/ClickHouse/clickhouse-jdbc/tree/master/clickhouse-jdbc - expand Batch Insert at the bottom to see examples

Zhichun Wu, [13.04.2022 14:54] I think in most cases, people only need to use standard JDBC API But they may need Java client if they prefer less overhead(type conversion, SQL parsing etc.)

filimonov avatar Sep 28 '22 12:09 filimonov

Hi @filimonov, yes, there's alternative in Java client and new driver.

  • Java Client https://github.com/ClickHouse/clickhouse-jdbc/blob/3e462a3cc90707189424b3137738abe59f606c85/clickhouse-client/src/test/java/com/clickhouse/client/ClientIntegrationTest.java#L1336-L1343
  • JDBC - see 5 in https://github.com/ClickHouse/clickhouse-jdbc/tree/master/clickhouse-jdbc#upgrade-to-032

zhicwu avatar Sep 28 '22 13:09 zhicwu