-
Notifications
You must be signed in to change notification settings - Fork 734
YDB FQ: docs for YDB as an external datasource #4790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
c107701
Started working on YDB docs
vitalyisaev2 1672ff3
YDB FQ: YDB as an external data source
vitalyisaev2 bf2fa61
Minor changes
vitalyisaev2 67b94e5
Review fixes
vitalyisaev2 3402bc9
Update ydb/docs/ru/core/concepts/federated_query/ydb.md
vitalyisaev2 e7eb1e3
Review fixes pt. 2
vitalyisaev2 ad6c1e2
Review fixes pt. 2
vitalyisaev2 4d97f3d
If oss clause
vitalyisaev2 f26440f
Merge branch 'main' into YQ-3033.ydb
vitalyisaev2 c311891
Update ydb/docs/ru/core/concepts/federated_query/_includes/supported_…
vitalyisaev2 31863da
Update ydb/docs/ru/core/concepts/federated_query/index.md
vitalyisaev2 142c949
Review fix
vitalyisaev2 05d3ba6
Merge branch 'YQ-3033.ydb' of github.com:vitalyisaev2/ydb into YQ-303…
vitalyisaev2 0c0bc96
Review fix pt. 2
vitalyisaev2 9e0c75c
Fix typo
vitalyisaev2 9d0f95c
Bump build
vitalyisaev2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+12.1 KB
(140%)
ydb/docs/ru/core/concepts/federated_query/_assets/architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
ydb/docs/ru/core/concepts/federated_query/_includes/connector_deployment.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {% if oss %}Развернуть [коннектор](../architecture.md#connectors) {% else %}Развернуть коннектор{% endif %} и [настроить](../../../deploy/manual/deploy-ydb-federated-query.md) динамические узлы {{ ydb-short-name }} на взаимодействие с ним. Также необходимо обеспечить сетевой доступ с динамических узлов {{ ydb-short-name }} к внешнему источнику данных (по адресу, указанному в параметре `LOCATION` запроса `CREATE EXTERNAL DATA SOURCE`). В случае, если на предыдущем шаге было включено шифрование сетевых соединений к внешнему источнику, коннектор будет использовать системные корневые сертификаты (более подробно о настройке TLS можно узнать в [инструкции](../../../deploy/manual/connector.md) по разворачиванию коннектора). |
2 changes: 1 addition & 1 deletion
2
ydb/docs/ru/core/concepts/federated_query/_includes/datetime_limits.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| Если значение даты, хранящейся во внешнем источнике данных, находится вне допустимого для {{ ydb-short-name }} диапазона (все используемые даты должны быть позднее 1970-01-01, но ранее 2105-12-31), такое значение в интерфейсе YDB будет отображаться как `NULL`. | ||
| Если значение даты, хранящейся во внешнем источнике данных, находится вне допустимого для {{ ydb-short-name }} диапазона (все используемые даты должны быть позднее 1970-01-01, но ранее 2105-12-31), в {{ ydb-short-name }} такое значение будет преобразовано в `NULL`. |
1 change: 1 addition & 0 deletions
1
ydb/docs/ru/core/concepts/federated_query/_includes/supported_requests.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Внешние источники доступны только для чтения данных через запросы `SELECT`. Запросы, модифицирующие таблицы во внешних источниках, движком обработки федеративных запросов в настоящее время не поддерживаются. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,8 @@ | ||
| items: | ||
| - { name: Обзор, href: index.md } | ||
| - { name: Архитектура, href: architecture.md } | ||
| - { name: Работа с базами данных PostgreSQL, href: postgresql.md } | ||
| - { name: Работа с базами данных ClickHouse, href: clickhouse.md } | ||
| - { name: Работа с базами данных PostgreSQL, href: postgresql.md } | ||
| - { name: Работа с базами данных YDB, href: ydb.md } | ||
| - name: Работа с бакетами S3 | ||
| include: { path: s3/toc_i.yaml, mode: link } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # Работа с базами данных YDB | ||
|
|
||
| {{ ydb-full-name }} может выступать в качестве внешнего источника данных для другой базы {{ ydb-full-name }}. В данном разделе рассматривается организация совместной работы двух независимых баз данных {{ ydb-short-name }} в режиме обработки федеративных запросов. | ||
|
|
||
| Для подключения к внешней базе {{ ydb-short-name }} со стороны другой базы {{ ydb-short-name }}, выступающей в роли движка обработки федеративных запросов, на последней требуется выполнить следующие шаги: | ||
| 1. Подготовить аутентификационные данные для доступа к удалённой базе {{ ydb-short-name }}. В настоящее время в федеративных запросах к {{ ydb-short-name }} доступен метод аутентификации по [логину и паролю](../../concepts/auth.md#static-credentials) (остальные методы не поддерживаются). Пароль к внешней базе сохраняется в виде [секрета](../datamodel/secrets.md): | ||
| ```sql | ||
| CREATE OBJECT ydb_datasource_user_password (TYPE SECRET) WITH (value = "<password>"); | ||
| ``` | ||
| 1. Создать [внешний источник данных](../datamodel/external_data_source.md), описывающий стороннюю базу {{ ydb-short-name }}. Параметр `LOCATION` содержит сетевой адрес экземпляра {{ ydb-short-name }}, к которому осуществляется сетевое подключение. В `DATABASE_NAME` указывается имя базы данных (например, `local`). Для аутентификации во внешнюю базу используются значения параметров `LOGIN` и `PASSWORD_SECRET_NAME`. Включить шифрование соединений к внешней базе данных можно с помощью параметра `USE_TLS="TRUE"`. Если шифрование включено, то в поле `<port>` параметра `LOCATION` необходимо указать порт gRPCs внешней {{ ydb-short-name }}, в противном случае - порт gRPC. | ||
| ```sql | ||
| CREATE EXTERNAL DATA SOURCE ydb_datasource WITH ( | ||
| SOURCE_TYPE="Ydb", | ||
| LOCATION="<host>:<port>", | ||
vitalyisaev2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| DATABASE_NAME="<database>", | ||
| AUTH_METHOD="BASIC", | ||
| LOGIN="user", | ||
| PASSWORD_SECRET_NAME="ydb_datasource_user_password", | ||
| USE_TLS="TRUE" | ||
| ); | ||
| ``` | ||
| 1. {% include [!](_includes/connector_deployment.md) %} | ||
| 1. [Выполнить запрос](#query) к внешнему источнику данных. | ||
|
|
||
| ## Синтаксис запросов { #query } | ||
| Для извлечения данных из таблиц внешней базы {{ ydb-short-name }} используется следующая форма SQL-запроса: | ||
|
|
||
| ```sql | ||
| SELECT * FROM ydb_datasource.`<table_name>` | ||
| ``` | ||
|
|
||
| где: | ||
| - `ydb_datasource` - идентификатор внешнего источника данных; | ||
| - `<table_name>` - полное имя таблицы внутри [иерархии](../../concepts/index.html#ydb-hierarchy) каталогов в базе данных {{ ydb-short-name }}, например, `table`, `dir1/table1` или `dir1/dir2/table3`. | ||
|
|
||
| В случае, если таблица находится на верхнем уровне иерархии (не принадлежит ни одному из каталогов), допускается не заключать имя таблицы в обратные апострофы "\`": | ||
vitalyisaev2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ```sql | ||
| SELECT * FROM ydb_datasource.<table_name> | ||
vitalyisaev2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| ## Ограничения | ||
|
|
||
| При работе с внешними источниками данных {{ ydb-short-name }} существует ряд ограничений: | ||
|
|
||
| 1. {% include [!](_includes/supported_requests.md) %} | ||
| 1. {% include [!](_includes/predicate_pushdown.md) %} | ||
|
|
||
| ## Поддерживаемые типы данных | ||
|
|
||
| При работе с таблицами, размещёнными во внешней базе {{ ydb-short-name }}, пользователям доступен ограниченный набор типов данных. Все остальные типы, за исключением перечисленных ниже, не поддерживаются. Преобразование типов не производится, то есть колонки таблицы из внешней базы {{ ydb-short-name }} сохраняют свой тип после вычитывания этой таблицы базой {{ ydb-short-name }}, обрабатывающей федеративный запрос. | ||
|
|
||
| |Тип данных {{ ydb-short-name }}| | ||
| |----| | ||
| |`Bool`| | ||
| |`Int8`| | ||
| |`Int16`| | ||
| |`Int32`| | ||
| |`Int64`| | ||
| |`Uint8`| | ||
| |`Uint16`| | ||
| |`Uint32`| | ||
| |`Uint64`| | ||
| |`Float`| | ||
| |`Double`| | ||
| |`String`| | ||
| |`Utf8`| | ||
| |`Date`| | ||
| |`Datetime`| | ||
| |`Timestamp`| | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.