> ## 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.

> Envía datos a ClickHouse con los pipelines de datos de Airbyte

# Conecta Airbyte con 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>
            Integración de partner
        </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 />

<Note>
  Ten en cuenta que los conectores de origen y destino de Airbyte para ClickHouse se encuentran actualmente en fase Alpha y no son adecuados para transferir grandes conjuntos de datos (> 10 millones de filas)
</Note>

<a href="https://www.airbyte.com/" target="_blank">Airbyte</a> es una plataforma de integración de datos de código abierto. Permite crear canalizaciones de datos <a href="https://airbyte.com/blog/why-the-future-of-etl-is-not-elt-but-el" target="_blank">ELT</a> e incluye más de 140 conectores listos para usar. Este tutorial paso a paso muestra cómo conectar Airbyte a ClickHouse como destino y cargar un conjunto de datos de ejemplo.

<Steps>
  <Step title="Descarga y ejecuta Airbyte" id="1-download-and-run-airbyte">
    1. Airbyte se ejecuta en Docker y utiliza `docker-compose`. Asegúrate de descargar e instalar las versiones más recientes de Docker.

    2. Despliega Airbyte clonando el repositorio oficial de GitHub y ejecutando `docker-compose up` en tu terminal preferido:

       ```bash theme={null}
       git clone https://github.com/airbytehq/airbyte.git --depth=1
       cd airbyte
       ./run-ab-platform.sh
       ```

    3. Cuando veas el banner de Airbyte en tu terminal, podrás conectarte a <a href="http://localhost:8000" target="_blank">localhost:8000</a>

           <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/airbyte_01.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=9b435943f12c98cfa35decc6406749b0" size="lg" border alt="Banner de Airbyte" width="1400" height="386" data-path="images/integrations/data-ingestion/etl-tools/airbyte_01.webp" />

    <Note>
      También puedes registrarte y usar <a href="https://docs.airbyte.com/" target="_blank">Airbyte Cloud</a>
    </Note>
  </Step>

  <Step title="Añadir ClickHouse como destino" id="2-add-clickhouse-as-a-destination">
    En esta sección, mostraremos cómo añadir una instancia de ClickHouse como destino.

    1. Inicie su servidor ClickHouse (Airbyte es compatible con la versión `21.8.10.19` de ClickHouse o superior) o inicie sesión en su cuenta de ClickHouse Cloud:

       ```bash theme={null}
       clickhouse-server start
       ```

    2. En Airbyte, seleccione la página "Destinations" y añada un nuevo destino:

           <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/airbyte_02.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=30db23316680695bf19c0a8d3147a750" size="lg" border alt="Añadir un destino en Airbyte" width="1132" height="896" data-path="images/integrations/data-ingestion/etl-tools/airbyte_02.webp" />

    3. Seleccione ClickHouse en la lista desplegable "Destination type" y complete el formulario "Set up the destination" indicando el hostname y los puertos de su instancia de ClickHouse, el nombre de la base de datos, el nombre de usuario y la contraseña, y seleccione si se trata de una conexión SSL (equivalente al indicador `--secure` en `clickhouse-client`):

           <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/airbyte_03.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=9a59de0c1780b94c2f26f65cbf7d44fa" size="lg" border alt="Creación del destino ClickHouse en Airbyte" width="807" height="1050" data-path="images/integrations/data-ingestion/etl-tools/airbyte_03.webp" />

    4. ¡Enhorabuena! Ya ha añadido ClickHouse como destino en Airbyte.

    <Note>
      Para usar ClickHouse como destino, el usuario que vaya a utilizar debe tener permisos para crear bases de datos, tablas e insertar filas. Recomendamos crear un usuario dedicado para Airbyte (p. ej., `my_airbyte_user`) con los siguientes permisos:

      ```sql theme={null}
      CREATE USER 'my_airbyte_user'@'%' IDENTIFIED BY 'your_password_here';

      GRANT CREATE ON * TO my_airbyte_user;
      ```
    </Note>
  </Step>

  <Step title="Añadir un conjunto de datos como fuente" id="3-add-a-dataset-as-a-source">
    El conjunto de datos de ejemplo que usaremos es <a href="/docs/es/get-started/sample-datasets/nyc-taxi" target="_blank">New York City Taxi Data</a> (en <a href="https://github.com/toddwschneider/nyc-taxi-data" target="_blank">GitHub</a>). Para este tutorial, usaremos un subconjunto de este conjunto de datos correspondiente al mes de enero de 2022.

    1. En Airbyte, selecciona la página "Sources" y añade una nueva fuente de tipo archivo.

           <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/airbyte_04.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=54f8f3c069543f0833ca579452df9437" size="lg" border alt="Añadir una fuente en Airbyte" width="2034" height="1014" data-path="images/integrations/data-ingestion/etl-tools/airbyte_04.webp" />

    2. Completa el formulario "Set up the source" asignando un nombre a la fuente y proporcionando la URL del archivo de NYC Taxi de enero de 2022 (consulta más abajo). Asegúrate de elegir `parquet` como formato de archivo, `HTTPS Public Web` como proveedor de almacenamiento y `nyc_taxi_2022` como nombre del conjunto de datos.

       ```text theme={null}
       https://d37ci6vzurychx.cloudfront.net/trip-data/yellow_tripdata_2022-01.parquet
       ```

           <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/airbyte_05.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=eaa49b96d86b1c3b77c5b81a0d005257" size="lg" border alt="Creación de fuente de ClickHouse en Airbyte" width="803" height="926" data-path="images/integrations/data-ingestion/etl-tools/airbyte_05.webp" />

    3. ¡Enhorabuena! Ya has añadido un archivo fuente en Airbyte.
  </Step>

  <Step title="Crear una conexión y cargar el conjunto de datos en ClickHouse" id="4-create-a-connection-and-load-the-dataset-into-clickhouse">
    1. En Airbyte, selecciona la página "Connections" y añade una nueva conexión

    <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/airbyte_06.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=08b1597ac1ccd4a3b53e20d24b3623bc" size="lg" border alt="Añadir una conexión en Airbyte" width="1664" height="952" data-path="images/integrations/data-ingestion/etl-tools/airbyte_06.webp" />

    2. Seleccione "Usar una fuente existente" y seleccione New York City Taxi Data; luego, seleccione "Usar un destino existente" y seleccione su instancia de ClickHouse.

    3. Completa el formulario "Configurar la conexión" seleccionando una Frecuencia de replicación (usaremos `manual` para este tutorial) y `nyc_taxi_2022` como el `stream` que quieres sincronizar. Asegúrate de elegir `Normalized Tabular Data` como normalización.

    <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/airbyte_07.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=cca97b2cf6502799aba8cf7928ef757a" size="lg" border alt="Creación de una conexión en Airbyte" width="1158" height="1265" data-path="images/integrations/data-ingestion/etl-tools/airbyte_07.webp" />

    4. Ahora que la conexión ya está creada, haz clic en "Sync now" para iniciar la carga de datos (ya que seleccionamos `Manual` como frecuencia de replicación)

    <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/airbyte_08.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=04b06556c1d144090303b4ecdf8d7b49" size="lg" border alt="Sincroniza ahora con Airbyte" width="2064" height="384" data-path="images/integrations/data-ingestion/etl-tools/airbyte_08.webp" />

    5. Tus datos empezarán a cargarse; puedes ampliar la vista para ver los logs y el progreso de Airbyte. Cuando finalice la operación, verás un mensaje `Completed successfully` en los logs:

    <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/airbyte_09.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=e7fd1c367e7dce7fef68f573aae7aa99" size="lg" border alt="Completado correctamente" width="2457" height="839" data-path="images/integrations/data-ingestion/etl-tools/airbyte_09.webp" />

    6. Conéctese a su instancia de ClickHouse con el cliente SQL que prefiera y compruebe la tabla resultante:

       ```sql theme={null}
       SELECT *
       FROM nyc_taxi_2022
       LIMIT 10
       ```

       La respuesta debería verse así:

       ```response theme={null}
       Query id: 4f79c106-fe49-4145-8eba-15e1cb36d325

       ┌─extra─┬─mta_tax─┬─VendorID─┬─RatecodeID─┬─tip_amount─┬─airport_fee─┬─fare_amount─┬─DOLocationID─┬─PULocationID─┬─payment_type─┬─tolls_amount─┬─total_amount─┬─trip_distance─┬─passenger_count─┬─store_and_fwd_flag─┬─congestion_surcharge─┬─tpep_pickup_datetime─┬─improvement_surcharge─┬─tpep_dropoff_datetime─┬─_airbyte_ab_id───────────────────────┬─────_airbyte_emitted_at─┬─_airbyte_normalized_at─┬─_airbyte_nyc_taxi_2022_hashid────┐
       │     0 │     0.5 │        2 │          1 │       2.03 │           0 │          17 │           41 │          162 │            1 │            0 │        22.33 │          4.25 │               3 │ N                  │                  2.5 │ 2022-01-24T16:02:27  │                   0.3 │ 2022-01-24T16:22:23   │ 000022a5-3f14-4217-9938-5657f9041c8a │ 2022-07-19 04:35:31.000 │    2022-07-19 04:39:20 │ 91F83E2A3AF3CA79E27BD5019FA7EC94 │
       │     3 │     0.5 │        1 │          1 │       1.75 │           0 │           5 │          186 │          246 │            1 │            0 │        10.55 │           0.9 │               1 │ N                  │                  2.5 │ 2022-01-22T23:23:05  │                   0.3 │ 2022-01-22T23:27:03   │ 000036b6-1c6a-493b-b585-4713e433b9cd │ 2022-07-19 04:34:53.000 │    2022-07-19 04:39:20 │ 5522F328014A7234E23F9FC5FA78FA66 │
       │     0 │     0.5 │        2 │          1 │       7.62 │        1.25 │          27 │          238 │           70 │            1 │         6.55 │        45.72 │          9.16 │               1 │ N                  │                  2.5 │ 2022-01-22T19:20:37  │                   0.3 │ 2022-01-22T19:40:51   │ 00003c6d-78ad-4288-a79d-00a62d3ca3c5 │ 2022-07-19 04:34:46.000 │    2022-07-19 04:39:20 │ 449743975782E613109CEE448AFA0AB3 │
       │   0.5 │     0.5 │        2 │          1 │          0 │           0 │         9.5 │          234 │          249 │            1 │            0 │         13.3 │           1.5 │               1 │ N                  │                  2.5 │ 2022-01-22T20:13:39  │                   0.3 │ 2022-01-22T20:26:40   │ 000042f6-6f61-498b-85b9-989eaf8b264b │ 2022-07-19 04:34:47.000 │    2022-07-19 04:39:20 │ 01771AF57922D1279096E5FFE1BD104A │
       │     0 │       0 │        2 │          5 │          5 │           0 │          60 │          265 │           90 │            1 │            0 │         65.3 │          5.59 │               1 │ N                  │                    0 │ 2022-01-25T09:28:36  │                   0.3 │ 2022-01-25T09:47:16   │ 00004c25-53a4-4cd4-b012-a34dbc128aeb │ 2022-07-19 04:35:46.000 │    2022-07-19 04:39:20 │ CDA4831B683D10A7770EB492CC772029 │
       │     0 │     0.5 │        2 │          1 │          0 │           0 │        11.5 │           68 │          170 │            2 │            0 │         14.8 │           2.2 │               1 │ N                  │                  2.5 │ 2022-01-25T13:19:26  │                   0.3 │ 2022-01-25T13:36:19   │ 00005c75-c3c8-440c-a8e8-b1bd2b7b7425 │ 2022-07-19 04:35:52.000 │    2022-07-19 04:39:20 │ 24D75D8AADD488840D78EA658EBDFB41 │
       │   2.5 │     0.5 │        1 │          1 │       0.88 │           0 │         5.5 │           79 │          137 │            1 │            0 │         9.68 │           1.1 │               1 │ N                  │                  2.5 │ 2022-01-22T15:45:09  │                   0.3 │ 2022-01-22T15:50:16   │ 0000acc3-e64f-4b58-8e15-dc47ff1685f3 │ 2022-07-19 04:34:37.000 │    2022-07-19 04:39:20 │ 2BB5B8E849A438E08F7FCF789E7D7E65 │
       │  1.75 │     0.5 │        1 │          1 │        7.5 │        1.25 │        27.5 │           17 │          138 │            1 │            0 │        37.55 │             9 │               1 │ N                  │                    0 │ 2022-01-30T21:58:19  │                   0.3 │ 2022-01-30T22:19:30   │ 0000b339-b44b-40b0-99f8-ebbf2092cc5b │ 2022-07-19 04:38:10.000 │    2022-07-19 04:39:20 │ DCCE79199EF9217CD769EFD5271302FE │
       │   0.5 │     0.5 │        2 │          1 │          0 │           0 │          13 │           79 │          140 │            2 │            0 │         16.8 │          3.19 │               1 │ N                  │                  2.5 │ 2022-01-26T20:43:14  │                   0.3 │ 2022-01-26T20:58:08   │ 0000caa8-d46a-4682-bd25-38b2b0b9300b │ 2022-07-19 04:36:36.000 │    2022-07-19 04:39:20 │ F502BE51809AF36582561B2D037B4DDC │
       │     0 │     0.5 │        2 │          1 │       1.76 │           0 │         5.5 │          141 │          237 │            1 │            0 │        10.56 │          0.72 │               2 │ N                  │                  2.5 │ 2022-01-27T15:19:54  │                   0.3 │ 2022-01-27T15:26:23   │ 0000cd63-c71f-4eb9-9c27-09f402fddc76 │ 2022-07-19 04:36:55.000 │    2022-07-19 04:39:20 │ 8612CDB63E13D70C1D8B34351A7CA00D │
       └───────┴─────────┴──────────┴────────────┴────────────┴─────────────┴─────────────┴──────────────┴──────────────┴──────────────┴──────────────┴──────────────┴───────────────┴─────────────────┴────────────────────┴──────────────────────┴──────────────────────┴───────────────────────┴───────────────────────┴──────────────────────────────────────┴─────────────────────────┴────────────────────────┴──────────────────────────────────┘
       ```

       ```sql theme={null}
       SELECT count(*)
       FROM nyc_taxi_2022
       ```

       La respuesta es:

       ```response theme={null}
       Query id: a9172d39-50f7-421e-8330-296de0baa67e

       ┌─count()─┐
       │ 2392428 │
       └─────────┘
       ```

    7. Ten en cuenta que Airbyte infirió automáticamente los tipos de datos y añadió 4 columnas a la tabla de destino. Airbyte utiliza estas columnas para gestionar la lógica de replicación y registrar las operaciones. Puedes encontrar más detalles en la <a href="https://docs.airbyte.com/integrations/destinations/clickhouse#output-schema" target="_blank">documentación oficial de Airbyte</a>.

       ```sql theme={null}
           `_airbyte_ab_id` String,
           `_airbyte_emitted_at` DateTime64(3, 'GMT'),
           `_airbyte_normalized_at` DateTime,
           `_airbyte_nyc_taxi_072021_hashid` String
       ```

       Ahora que el conjunto de datos está cargado en tu instancia de ClickHouse, puedes crear una nueva tabla y usar tipos de datos de ClickHouse más apropiados (<a href="/docs/es/get-started/sample-datasets/nyc-taxi" target="_blank">más detalles</a>).

    8. ¡Enhorabuena! Has cargado correctamente los datos de taxis de Nueva York en ClickHouse con Airbyte.
  </Step>
</Steps>
