ru.yandex.clickhouse

## Class Writer

- java.lang.Object
- - ru.yandex.clickhouse.Writer

    public class Writer
    extends Object

### Field Summary

Fields
`protected ClickHouseStatementImpl` `statement`

### Method Summary

All Methods Instance Methods Concrete Methods
`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)`
`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)` Sends the data in RowBinary or in Native formats
`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)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### statement

    protected final ClickHouseStatementImpl statement

### Method Detail

#### format

    public Writer format(ClickHouseFormat format)

Specifies format for further insert of data via send()

#### table

    public Writer table(String table)

Set table name for data insertion

Parameters:
  `table` - table name
Returns:
  this

#### sql

    public Writer sql(String sql)

Set SQL for data insertion

Parameters:
  `sql` - in a form "INSERT INTO table_name [(X,Y,Z)] VALUES "
Returns:
  this

#### data

    public Writer data(InputStream stream)

Specifies data input stream

#### data

    public Writer data(InputStream stream,
                       ClickHouseFormat format)

#### data

    public Writer data(File input)

Shortcut method for specifying a file as an input

#### data

    public Writer data(InputStream stream,
                       ClickHouseFormat format,
                       ClickHouseCompression compression)

#### data

    public Writer data(File input,
                       ClickHouseFormat format,
                       ClickHouseCompression compression)

#### dataCompression

    public Writer dataCompression(ClickHouseCompression compression)

#### data

    public Writer data(File input,
                       ClickHouseFormat format)

#### send

    public void send()
              throws SQLException

Method to call, when Writer is fully configured

Throws:
  `SQLException`

#### send

    public void send(String sql,
                     InputStream data,
                     ClickHouseFormat format)
              throws SQLException

Allows to send stream of data to ClickHouse

Parameters:
  `sql` - in a form of "INSERT INTO table_name (X,Y,Z) VALUES "
  `data` - where to read data from
  `format` - format of data in InputStream
Throws:
  `SQLException`

#### sendToTable

    public void sendToTable(String table,
                            InputStream data,
                            ClickHouseFormat format)
                     throws SQLException

Convenient method for importing the data into table

Parameters:
  `table` - table name
  `data` - source data
  `format` - format of data in InputStream
Throws:
  `SQLException`

#### send

    public void send(String sql,
                     ClickHouseStreamCallback callback,
                     ClickHouseFormat format)
              throws SQLException

Sends the data in RowBinary or in Native formats

Throws:
  `SQLException`

#### getCompression

    public ClickHouseCompression getCompression()

#### addDbParam

    public T addDbParam(ClickHouseQueryParam param,
                        String value)

#### removeDbParam

    public T removeDbParam(ClickHouseQueryParam param)

#### withDbParams

    public T withDbParams(Map<ClickHouseQueryParam,String> dbParams)

#### options

    public T options(Map<String,String> params)

#### option

    public T option(String key,
                    String value)

#### removeOption

    public T removeOption(String key)