Skip to content

Importing csv file into table #1001

@kiwimg

Description

@kiwimg

How to import CSV files into a table?

v0.3.2-patch10,use “ com.clickhouse.jdbc.ClickHouseStatement” Is this correct?
clickHouseStatement.write() // Write API entrypoint
.table(endPiont).format(ClickHouseFormat.CSV)// where to write data
.data(file.getAbsolutePath(), ClickHouseCompression.ZIP)/// specify input
.send();

ru.yandex.clickhouse.* will Deprecated

Before 0.3.2...
import ru.yandex.clickhouse.ClickHouseStatement;
ClickHouseStatement sth = connection.createStatement();
sth
.write() // Write API entrypoint
.table("default.my_table") // where to write data
.option("format_csv_delimiter", ";") // specific param
.data(new File("/path/to/file.csv.gz"), ClickHouseFormat.CSV, ClickHouseCompression.gzip) // specify input
.send();

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions