public class Writer extends Object
| Modifier and Type | Field and Description |
|---|---|
protected ClickHouseStatementImpl |
statement |
| Modifier and Type | Method and Description |
|---|---|
T |
addDbParam(ClickHouseQueryParam param,
String value) |
Writer |
data(File input)
Shortcut method for specifying a file as an input.
|
Writer |
data(File input,
ClickHouseFormat format) |
Writer |
data(File input,
ClickHouseFormat format,
ClickHouseCompression compression) |
Writer |
data(InputStream stream)
Specifies data input stream.
|
Writer |
data(InputStream stream,
ClickHouseFormat format)
Specifies data input stream, and the format to use.
|
Writer |
data(InputStream stream,
ClickHouseFormat format,
ClickHouseCompression compression) |
Writer |
dataCompression(ClickHouseCompression compression) |
Writer |
format(ClickHouseFormat format)
Specifies format for further insert of data via send().
|
ClickHouseCompression |
getCompression() |
T |
option(String key,
String value) |
T |
options(Map<String,String> params) |
T |
removeDbParam(ClickHouseQueryParam param) |
T |
removeOption(String key) |
void |
send()
Method to call, when Writer is fully configured.
|
void |
send(String sql,
ClickHouseStreamCallback callback,
ClickHouseFormat format)
|
void |
send(String sql,
InputStream data,
ClickHouseFormat format)
Allows to send stream of data to ClickHouse.
|
void |
sendToTable(String table,
InputStream data,
ClickHouseFormat format)
Convenient method for importing the data into table.
|
Writer |
sql(String sql)
Set SQL for data insertion.
|
Writer |
table(String table)
Set table name for data insertion.
|
T |
withDbParams(Map<ClickHouseQueryParam,String> dbParams) |
protected final ClickHouseStatementImpl statement
public Writer format(ClickHouseFormat format)
format - the format of the data to uploadpublic Writer table(String table)
table - name of the table to upload the data topublic Writer sql(String sql)
sql - in a form "INSERT INTO table_name [(X,Y,Z)] VALUES "public Writer data(InputStream stream)
stream - a stream providing the data to uploadpublic Writer data(InputStream stream, ClickHouseFormat format)
stream - a stream providing the data to uploadformat - the format of the data to uploadpublic Writer data(File input)
input - the file to uploadpublic Writer data(InputStream stream, ClickHouseFormat format, ClickHouseCompression compression)
public Writer data(File input, ClickHouseFormat format, ClickHouseCompression compression)
public Writer dataCompression(ClickHouseCompression compression)
public Writer data(File input, ClickHouseFormat format)
public void send()
throws SQLException
SQLExceptionpublic void send(String sql, InputStream data, ClickHouseFormat format) throws SQLException
sql - in a form of "INSERT INTO table_name (X,Y,Z) VALUES "data - where to read data fromformat - format of data in InputStreamSQLException - if the upload failspublic void sendToTable(String table, InputStream data, ClickHouseFormat format) throws SQLException
table - table namedata - source dataformat - format of data in InputStreamSQLException - if the upload failspublic void send(String sql, ClickHouseStreamCallback callback, ClickHouseFormat format) throws SQLException
sql - the SQL statement to executecallback - data source for the uploadformat - the format to use, either RowBinary or NativeSQLException - if the upload failspublic ClickHouseCompression getCompression()
public T addDbParam(ClickHouseQueryParam param, String value)
public T removeDbParam(ClickHouseQueryParam param)
public T withDbParams(Map<ClickHouseQueryParam,String> dbParams)
public T removeOption(String key)
Copyright © 2015–2021 ClickHouse. All rights reserved.