Hi, how to insert collection json strings into a table?
For example, I have a collection of objects, convert them to json strings and send them to a table.
// sorry for scala code
val sb = new StringBuilder()
events.map(ev => json.eventToString(ev)).foreach(s => sb.append(s +"\n"))
val stream = new ByteArrayInputStream(sb.toString().getBytes("UTF-8") )
try {
sth.write().sendToTable(table, stream, ClickHouseFormat.JSONStringEachRow)
} catch {
case ex: java.sql.SQLException => log.error("An error occurred when inserting data into clickhouse", ex)
}
but an exception occurs:
DB::Exception: Format JSONStringEachRow is not suitable for input (with processors).
I didn't find an example of using JSONStringEachRow in unit tests.