---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://ydb.tech/docs/en/concepts/datamodel/external_data_source.md
  - https://ydb.tech/docs/ru/concepts/datamodel/external_data_source.md
sourcePath: en/core/concepts/datamodel/external_data_source.md
---
> **Documentation Index:** Fetch the complete configuration index at https://ydb.tech/docs/en/llms.txt

# External Data Sources

An external data source is an object in YDB that describes the connection parameters to an external data source. For example, in the case of ClickHouse, the external data source describes the network address, login, and password for authentication in the ClickHouse cluster. In the case of S3 (Object Storage), it describes the access credentials and the path to the bucket.

The following example demonstrates creating an external data source pointing to a ClickHouse cluster:

```yql
CREATE EXTERNAL DATA SOURCE test_data_source WITH (
  SOURCE_TYPE="ClickHouse",
  LOCATION="192.168.1.1:8123",
  DATABASE_NAME="default",
  AUTH_METHOD="BASIC",
  USE_TLS="TRUE",
  LOGIN="login",
  PASSWORD_SECRET_PATH="test_password_path",
  PROTOCOL="NATIVE"
);
```

After creating an external data source, you can read data from the created `EXTERNAL DATA SOURCE` object. The example below illustrates reading data from the `test_table` table in the `default` database in the ClickHouse cluster:

```yql
SELECT * FROM test_data_source.test_table;
```

External data sources allow execution of [federated queries](https://ydb.tech/docs/en/concepts/query_execution/federated_query/index.md) for cross-system data analytics tasks.

The following data sources can be used:

- [ClickHouse](https://ydb.tech/docs/en/concepts/query_execution/federated_query/clickhouse.md)
- [PostgreSQL](https://ydb.tech/docs/en/concepts/query_execution/federated_query/postgresql.md)
- [Connections to S3 (Object Storage)](https://ydb.tech/docs/en/concepts/query_execution/federated_query/s3/external_data_source.md)
