Upload files to Cloud
ClickHouse Cloud provides an easy way to import your files and supports the following formats:
Format |
---|
CSV |
CSVWithNamesAndTypes |
CSVWithNames |
JSONEachRow |
TabSeparated |
TabSeparatedWithNames |
TabSeparatedWithNamesAndTypes |
Upload a file
From the Cloud homepage, select your service as shown below:
If your service is idle you will need to wake it.
Select Data sources
in the left hand tab as shown below:
Next select Upload a file
on the right side of the data sources page:
A file dialogue will pop up allowing you to select the file that you wish to use to insert data into a table on your Cloud service.
Configure table
Once the file has uploaded you will be able to configure the table where you want to insert the data to. A preview of the table with the first three rows is shown.
You can now select a destination table. The options are:
- a new table
- an existing table
You can specify which database you want to upload the data to, and in the case of a new table, the name of the table that will be created. You will also be able to select the sorting key:
Columns read from the file are shown as Source field
s and for each field, you
can change:
- the inferred type
- the default value
- whether to make the column Nullable or not
You can also remove a field if you don't want to include it in the import
You can specify the type of table engine that you want to use:
MergeTree
ReplacingMergeTree
SummingMergeTree
Null
You can specify a partitioning key expression and primary key expression.
Click Import to ClickHouse
(shown above) to import the data. The data import will be queued as
indicated by the queued
status badge in the Status
column as shown below. You can also click
Open as query
(shown above) to open the insert query in the SQL console. The query will insert
the file which was uploaded to an S3 bucket using the URL
table function.
If the job fails you will see a failed
status badge under the Status
column of
the Data upload history
tab. You can click View Details
for more information
on why the upload failed. You may need to modify the table configuration or clean
the data based on the error message for the failed insert.