> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> Stream data into ClickHouse using BladePipe data pipelines

# Connect BladePipe to ClickHouse

export const PartnerBadge = () => {
  return <div className="PartnerBadge">
            <div className="PartnerBadgeIcon">
                <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <polyline points="12.5 9.5 10 12 6 11 2.5 8.5" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1" />
                    <polyline points="4.54 4.41 8 3.5 11.46 4.41" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1" />
                    <path d="M2.15,3.78 L0.55,6.95 A0.5,0.5 0,0,0 0.77,7.62 L2.5,8.5 L4.54,4.41 L2.82,3.55 A0.5,0.5 0,0,0 2.15,3.78 Z" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1" />
                    <path d="M13.5,8.5 L15.23,7.62 A0.5,0.5 0,0,0 15.45,6.95 L13.85,3.78 A0.5,0.5 0,0,0 13.18,3.55 L11.46,4.41 Z" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1" />
                    <path d="M11.5,4.5 L9,4.5 L6.15,7.27 A0.5,0.5 0,0,0 6.24,8.05 C7.33,8.74 8.81,8.72 10,7.5 L12.5,9.5 L13.5,8.5" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1" />
                    <polyline points="7.75 13.5 5.15 12.85 3.5 11.67" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1" />
                </svg>
            </div>
            Partner Integration
        </div>;
};

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

<PartnerBadge />

<a href="https://www.bladepipe.com/" target="_blank">BladePipe</a> is a real-time end-to-end data integration tool with sub-second latency, boosting seamless data flow across platforms.

ClickHouse is one of BladePipe's pre-built connectors, allowing users to integrate data from various sources into ClickHouse automatically. This page will show how to load data into ClickHouse in real time step by step.

<h2 id="supported-sources">
  Supported sources
</h2>

Currently BladePipe supports for data integration to ClickHouse from the following sources:

* MySQL/MariaDB/AuroraMySQL
* Oracle
* PostgreSQL/AuroraPostgreSQL
* MongoDB
* Kafka
* PolarDB-MySQL
* OceanBase
* TiDB

More sources are to be supported.

<Steps>
  <Step title="Download and run BladePipe" id="1-run-bladepipe">
    1. Log in to <a href="https://www.bladepipe.com/" target="_blank">BladePipe Cloud</a>.

    2. Follow the instructions in <a href="https://doc.bladepipe.com/productOP/byoc/installation/install_worker_docker" target="_blank">Install Worker (Docker)</a> or <a href="https://doc.bladepipe.com/productOP/byoc/installation/install_worker_binary" target="_blank">Install Worker (Binary)</a> to download and install a BladePipe Worker.

    <Note>
      Alternatively, you can download and deploy <a href="https://doc.bladepipe.com/productOP/onPremise/installation/install_all_in_one_binary" target="_blank">BladePipe Enterprise</a>.
    </Note>
  </Step>

  <Step title="Add ClickHouse as a target" id="2-add-clickhouse-as-a-target">
    <Note>
      1. BladePipe supports ClickHouse version `20.12.3.3` or above.
      2. To use ClickHouse as a target, make sure that the user has SELECT, INSERT and common DDL permissions.
    </Note>

    1. In BladePipe, click "DataSource" > "Add DataSource".

    2. Select `ClickHouse`, and fill out the settings by providing your ClickHouse host and port, username and password, and click "Test Connection".

           <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/bp_ck_1.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=63b11e4a76a8fedaf8a98c4d3a496fa6" size="lg" border alt="Add ClickHouse as a target" width="1882" height="1744" data-path="images/integrations/data-ingestion/etl-tools/bp_ck_1.webp" />

    3. Click "Add DataSource" at the bottom, and a ClickHouse instance is added.
  </Step>

  <Step title="Add MySQL as a source" id="3-add-mysql-as-a-source">
    In this tutorial, we use a MySQL instance as the source, and explain the process of loading MySQL data to ClickHouse.

    <Note>
      To use MySQL as a source, make sure that the user has the <a href="https://doc.bladepipe.com/dataMigrationAndSync/datasource_func/MySQL/privs_for_mysql" target="_blank">required permissions</a>.
    </Note>

    1. In BladePipe, click "DataSource" > "Add DataSource".

    2. Select `MySQL`, and fill out the settings by providing your MySQL host and port, username and password, and click "Test Connection".

           <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/bp_ck_2.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=86149981e4823e8ffc94d870405a0674" size="lg" border alt="Add MySQL as a source" width="1882" height="1746" data-path="images/integrations/data-ingestion/etl-tools/bp_ck_2.webp" />

    3. Click "Add DataSource" at the bottom, and a MySQL instance is added.
  </Step>

  <Step title="Create a pipeline" id="4-create-a-pipeline">
    1. In BladePipe, click "DataJob" > "Create DataJob".

    2. Select the added MySQL and ClickHouse instances and click "Test Connection" to ensure BladePipe is connected to the instances. Then, select the databases to be moved.
           <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/bp_ck_3.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=6c86c863a807dc03306618540b9167ab" size="lg" border alt="Select source and target" width="3264" height="1904" data-path="images/integrations/data-ingestion/etl-tools/bp_ck_3.webp" />

    3. Select "Incremental" for DataJob Type, together with the "Full Data" option.
           <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/bp_ck_4.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=0bb27a97a3e1b70fd1b5590af98ea1e8" size="lg" border alt="Select sync type" width="2248" height="1884" data-path="images/integrations/data-ingestion/etl-tools/bp_ck_4.webp" />

    4. Select the tables to be replicated.
           <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/bp_ck_5.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=750373dc99b3fc14365d4b8b5cba5786" size="lg" border alt="Select tables" width="2956" height="1730" data-path="images/integrations/data-ingestion/etl-tools/bp_ck_5.webp" />

    5. Select the columns to be replicated.
           <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/bp_ck_6.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=d4fb0124a2705ab7b41cc727645b326b" size="lg" border alt="Select columns" width="2960" height="1738" data-path="images/integrations/data-ingestion/etl-tools/bp_ck_6.webp" />

    6. Confirm the DataJob creation, and the DataJob runs automatically.
           <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/bp_ck_8.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=abbfdab480cf84fbe2047ec33a0b9111" size="lg" border alt="DataJob is running" width="2244" height="294" data-path="images/integrations/data-ingestion/etl-tools/bp_ck_8.webp" />
  </Step>

  <Step title="Verify the data" id="5-verify-the-data">
    1. Stop data write in MySQL instance and wait for ClickHouse to merge data.

    <Note>
      Due to the unpredictable timing of ClickHouse's automatic merging, you can manually trigger a merging by running the `OPTIMIZE TABLE xxx FINAL;` command. Note that there is a chance that this manual merging may not always succeed.

      Alternatively, you can run the `CREATE VIEW xxx_v AS SELECT * FROM xxx FINAL;` command to create a view and perform queries on the view to ensure the data is fully merged.
    </Note>

    2. Create a <a href="https://doc.bladepipe.com/operation/job_manage/create_job/create_period_verification_correction_job" target="_blank">Verification DataJob</a>. Once the Verification DataJob is completed, review the results to confirm that the data in ClickHouse is the same as the data in MySQL.
           <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/bp_ck_9.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=85a6aedaebcf7d61338b632241660fda" size="lg" border alt="Verify data" width="2234" height="286" data-path="images/integrations/data-ingestion/etl-tools/bp_ck_9.webp" />
  </Step>
</Steps>
