> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-trino-dialect.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload files to Cloud

> Learn how to upload files to Cloud

export const Image = ({img, alt, size = "lg", background}) => {
  const normalizedSize = ["sm", "md", "lg"].includes(size) ? size : "lg";
  const backgroundColor = background === "white" ? "white" : background === "black" ? "rgb(31 31 28)" : undefined;
  return <div className={`ch-image-${normalizedSize}`}>
      <Frame>
        <img src={img} alt={alt} style={{
    backgroundColor
  }} />
      </Frame>
    </div>;
};

ClickHouse Cloud provides an easy way to import your files and supports the
following formats:

| Format                          |
| ------------------------------- |
| `CSV`                           |
| `CSVWithNamesAndTypes`          |
| `CSVWithNames`                  |
| `JSONEachRow`                   |
| `TabSeparated`                  |
| `TabSeparatedWithNames`         |
| `TabSeparatedWithNamesAndTypes` |

<Steps>
  <Step title="Upload a file" id="upload-file">
    From the Cloud homepage, select your service as shown below:

    <Image img="https://mintcdn.com/private-7c7dfe99-trino-dialect/tyM7Sy7bE2MbONr4/images/cloud/migrate/csv_01.webp?fit=max&auto=format&n=tyM7Sy7bE2MbONr4&q=85&s=8aaf4271793e48ae43ff2d9083b0c9d1" alt="upload_file_02" width="3024" height="1483" data-path="images/cloud/migrate/csv_01.webp" />

    If your service is idle you will need to wake it.

    Select `Data sources` in the left hand tab as shown below:

    <Image img="https://mintcdn.com/private-7c7dfe99-trino-dialect/tyM7Sy7bE2MbONr4/images/cloud/migrate/csv_02.webp?fit=max&auto=format&n=tyM7Sy7bE2MbONr4&q=85&s=13b3109c35b9687ff2f2f68532327dda" alt="upload_file_03" width="3024" height="1483" data-path="images/cloud/migrate/csv_02.webp" />

    Next select `Upload a file` on the right side of the data sources page:

    <Image img="https://mintcdn.com/private-7c7dfe99-trino-dialect/tyM7Sy7bE2MbONr4/images/cloud/migrate/csv_03.webp?fit=max&auto=format&n=tyM7Sy7bE2MbONr4&q=85&s=7c51b93f4bf4da3c800dbaf0af3b1e86" alt="upload_file_04" width="3024" height="1483" data-path="images/cloud/migrate/csv_03.webp" />

    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.

    <Image img="https://mintcdn.com/private-7c7dfe99-trino-dialect/tyM7Sy7bE2MbONr4/images/cloud/migrate/csv_04.webp?fit=max&auto=format&n=tyM7Sy7bE2MbONr4&q=85&s=11ded4091b40db1c645d2b798a7efc71" alt="upload_file_05" width="1267" height="736" data-path="images/cloud/migrate/csv_04.webp" />
  </Step>

  <Step title="Configure table" id="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.

    <Image img="https://mintcdn.com/private-7c7dfe99-trino-dialect/tyM7Sy7bE2MbONr4/images/cloud/migrate/csv_08.webp?fit=max&auto=format&n=tyM7Sy7bE2MbONr4&q=85&s=97ffd1557c77d06f1286346205f50aca" alt="upload_file_08" width="3018" height="1476" data-path="images/cloud/migrate/csv_08.webp" />

    You can now select a destination table. The options are:

    * a new table
    * an existing table

    <br />

    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:

    <Image img="https://mintcdn.com/private-7c7dfe99-trino-dialect/tyM7Sy7bE2MbONr4/images/cloud/migrate/csv_05.webp?fit=max&auto=format&n=tyM7Sy7bE2MbONr4&q=85&s=75b769a0f04ed43e401e51efe34d0465" alt="upload_file_05" width="3016" height="1474" data-path="images/cloud/migrate/csv_05.webp" />

    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](/reference/data-types/nullable) or not

    <Image img="https://mintcdn.com/private-7c7dfe99-trino-dialect/tyM7Sy7bE2MbONr4/images/cloud/migrate/csv_06.webp?fit=max&auto=format&n=tyM7Sy7bE2MbONr4&q=85&s=0402c8cd6f17e9c8bf3e6b242ed1565a" alt="upload_file_06" width="3012" height="1476" data-path="images/cloud/migrate/csv_06.webp" />

    <Info>
      **Excluding fields**

      You can also remove a field if you don't want to include it in the import
    </Info>

    You can specify the type of table engine that you want to use:

    * `MergeTree`
    * `ReplacingMergeTree`
    * `SummingMergeTree`
    * `Null`

    <br />

    You can specify a partitioning key expression and primary
    key expression.

    <Image img="https://mintcdn.com/private-7c7dfe99-trino-dialect/tyM7Sy7bE2MbONr4/images/cloud/migrate/csv_07.webp?fit=max&auto=format&n=tyM7Sy7bE2MbONr4&q=85&s=c96f4d50d2642b02e5bd97c2ec3819b4" alt="upload_file_07" width="3004" height="1476" data-path="images/cloud/migrate/csv_07.webp" />

    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.

    <Image img="https://mintcdn.com/private-7c7dfe99-trino-dialect/tyM7Sy7bE2MbONr4/images/cloud/migrate/csv_09.webp?fit=max&auto=format&n=tyM7Sy7bE2MbONr4&q=85&s=ef9f394d28f0e9a7bed9932e78420455" alt="upload_file_09" width="1271" height="487" data-path="images/cloud/migrate/csv_09.webp" />

    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.

    <Image img="https://mintcdn.com/private-7c7dfe99-trino-dialect/tyM7Sy7bE2MbONr4/images/cloud/migrate/csv_10.webp?fit=max&auto=format&n=tyM7Sy7bE2MbONr4&q=85&s=b8e078d09ffb24901b2a81f6b8fcb566" alt="upload_file_11" width="1260" height="262" data-path="images/cloud/migrate/csv_10.webp" />
  </Step>
</Steps>
