Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% note warning %}

{% include [column-and-row-tables-in-read-only-tx](./limitation-column-row-in-read-only-tx.md) %}

{% endnote %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The simultaneous use of [column-oriented tables](../concepts/glossary.md#column-oriented-table) and [row-oriented tables](../concepts/glossary.md#row-oriented-table) is possible only in read-only transactions. Support for write transactions involving both types of tables simultaneously is under development.

If a write transaction includes both types of tables, it fails with the following error: `Write transactions between column and row tables are disabled at current time`.
12 changes: 11 additions & 1 deletion ydb/docs/en/core/concepts/_includes/transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ A [topic](../topic.md) in {{ ydb-short-name }} can be sharded into several parti

## Transactions with topics and tables {#topic-table-transactions}

{% note warning %}

{% include [not_allow_for_olap](../../_includes/not_allow_for_olap_text.md) %}

{% endnote %}

{{ ydb-short-name }} supports transactions involving [row-oriented tables](../glossary.md#row-oriented-table) and/or [topics](../glossary.md#topic). This makes it possible to transactionally transfer data from tables to topics and vice versa, as well as between topics. This ensures that data is neither lost nor duplicated in case of a network outage or other issues. This enables the implementation of the transactional outbox pattern within {{ ydb-short-name }}.

For more information about transactions with tables and topics in {{ ydb-short-name }}, see [{#T}](../topic.md#topic-transactions) and [{#T}](../../reference/ydb-sdk/topic.md).
For more information about transactions with tables and topics in {{ ydb-short-name }}, see [{#T}](../topic.md#topic-transactions) and [{#T}](../../reference/ydb-sdk/topic.md).

## Transactions with Column and Row Tables {#mixed-transactions}

{% include [limitation](../../_includes/limitation-column-row-in-read-only-tx.md) %}
12 changes: 1 addition & 11 deletions ydb/docs/en/core/yql/reference/syntax/delete.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
# DELETE FROM

{% if oss == true and backend_name == "YDB" %}

{% note warning %}

Supported only for [row-oriented](../../../concepts/datamodel/table.md#row-oriented-tables) tables. Support for [column-oriented](../../../concepts/datamodel/table.md#column-oriented-tables) tables is currently under development.

Instead of using `DELETE FROM` to delete data from colum-oriented tables, you can use the mechanism of deleting rows by time — [TTL](../../../concepts/ttl.md). TTL can be set when [creating](create_table/index.md) the table via `CREATE TABLE` or [modified](alter_table/index.md) later via `ALTER TABLE`.

{% endnote %}

{% endif %}
{% include [column-and-row-tables-in-read-only-tx](../../../_includes/limitation-column-row-in-read-only-tx-warn.md) %}

Deletes rows that match the `WHERE` clause, from the table.{% if feature_mapreduce %} The table is searched by name in the database specified by the [USE](use.md) operator.{% endif %}

Expand Down
22 changes: 2 additions & 20 deletions ydb/docs/en/core/yql/reference/syntax/insert_into.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,8 @@
# INSERT INTO

{% if oss == true and backend_name == "YDB" %}
{% include [column-and-row-tables-in-read-only-tx](../../../_includes/limitation-column-row-in-read-only-tx-warn.md) %}

{% note warning %}

Supported only for [row-oriented](../../../concepts/datamodel/table.md#row-oriented-tables) tables. Support for [column-oriented](../../../concepts/datamodel/table.md#column-oriented-tables) tables is currently under development.

{% if oss %}

Available methods for loading data into columnar tables:

* [{{ ydb-short-name }} CLI](../../../reference/ydb-cli/export-import/import-file.md)
* [Bulk data upsert](../../../recipes/ydb-sdk/bulk-upsert.md)
* [Yandex Data Transfer](https://yandex.cloud/ru/services/data-transfer)

{% endif %}

{% endnote %}

{% endif %}

{% if select_command != "SELECT STREAM" %} Adds rows to the table. {% if feature_bulk_tables %} If the target table already exists and is not sorted, the operation `INSERT INTO` adds rows at the end of the table. In the case of a sorted table, YQL tries to preserve sorting by running a sorted merge. {% endif %}{% if feature_map_tables %} If you try to insert a row into a table with an existing primary key value, the operation fails with the `PRECONDITION_FAILED` error code and the `Operation aborted due to constraint violation: insert_pk` message returned.{% endif %}
{% if select_command != "SELECT STREAM" %} Adds rows to the table.{% if feature_bulk_tables %} If the target table already exists and is not sorted, the operation `INSERT INTO` adds rows at the end of the table. In the case of a sorted table, YQL tries to preserve sorting by running a sorted merge. {% endif %}{% if feature_map_tables %} If you try to insert a row into a table with an existing primary key value, the operation fails with the `PRECONDITION_FAILED` error code and the `Operation aborted due to constraint violation: insert_pk` message returned.{% endif %}

{% if feature_mapreduce %}The table is searched by name in the database specified by the [USE](use.md) operator.{% endif %}

Expand Down
20 changes: 1 addition & 19 deletions ydb/docs/en/core/yql/reference/syntax/replace_into.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
# REPLACE INTO

{% if oss == true and backend_name == "YDB" %}

{% note warning %}

Supported only for [row-oriented](../../../concepts/datamodel/table.md#row-oriented-tables) tables. Support for [column-oriented](../../../concepts/datamodel/table.md#column-oriented-tables) tables is currently under development.

{% if oss %}

Available methods for loading data into columnar tables:

* [{{ ydb-short-name }} CLI](../../../reference/ydb-cli/export-import/import-file.md)
* [Bulk data upsert](../../../recipes/ydb-sdk/bulk-upsert.md)
* [Yandex Data Transfer](https://yandex.cloud/ru/services/data-transfer)

{% endif %}

{% endnote %}

{% endif %}
{% include [column-and-row-tables-in-read-only-tx](../../../_includes/limitation-column-row-in-read-only-tx-warn.md) %}

Saves data to a table, overwriting the rows based on the primary key.{% if feature_mapreduce %} The table is searched by name in the database specified by the [USE](use.md) operator.{% endif %} If the given primary key is missing, a new row is added to the table. If the given `PRIMARY_KEY` exists, the row is overwritten. The values of columns not involved in the operation are replaced by their default values.

Expand Down
20 changes: 1 addition & 19 deletions ydb/docs/en/core/yql/reference/syntax/update.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
# UPDATE

{% if oss == true and backend_name == "YDB" %}

{% note warning %}

Supported only for [row-oriented](../../../concepts/datamodel/table.md#row-oriented-tables) tables. Support for [column-oriented](../../../concepts/datamodel/table.md#column-oriented-tables) tables is currently under development.

{% if oss %}

Available methods for loading data into columnar tables:

* [{{ ydb-short-name }} CLI](../../../reference/ydb-cli/export-import/import-file.md)
* [Bulk data upsert](../../../recipes/ydb-sdk/bulk-upsert.md)
* [Yandex Data Transfer](https://yandex.cloud/ru/services/data-transfer)

{% endif %}

{% endnote %}

{% endif %}
{% include [column-and-row-tables-in-read-only-tx](../../../_includes/limitation-column-row-in-read-only-tx-warn.md) %}

Updates the data in the table.{% if feature_mapreduce %} The table is searched by name in the database specified by the [USE](use.md) operator.{% endif %} After the `SET` keyword, enter the columns where you want to update values and the new values themselves. The list of rows is defined by the `WHERE` clause. If `WHERE` is omitted, the updates are applied to all the rows of the table.

Expand Down
20 changes: 1 addition & 19 deletions ydb/docs/en/core/yql/reference/syntax/upsert_into.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
# UPSERT INTO

{% if oss == true and backend_name == "YDB" %}

{% note warning %}

Supported only for [row-oriented](../../../concepts/datamodel/table.md#row-oriented-tables) tables. Support for [column-oriented](../../../concepts/datamodel/table.md#column-oriented-tables) tables is currently under development.

{% if oss %}

Available methods for loading data into columnar tables:

* [{{ ydb-short-name }} CLI](../../../reference/ydb-cli/export-import/import-file.md)
* [Bulk data upsert](../../../recipes/ydb-sdk/bulk-upsert.md)
* [Yandex Data Transfer](https://yandex.cloud/ru/services/data-transfer)

{% endif %}

{% endnote %}

{% endif %}
{% include [column-and-row-tables-in-read-only-tx](../../../_includes/limitation-column-row-in-read-only-tx-warn.md) %}

UPSERT (which stands for UPDATE or INSERT) updates or inserts multiple rows to a table based on a comparison by the primary key. Missing rows are added. For the existing rows, the values of the specified columns are updated, but the values of the other columns are preserved.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% note warning %}

{% include [column-and-row-tables-in-read-only-tx](./limitation-column-row-in-read-only-tx.md) %}

{% endnote %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
В настоящее время одновременное использование [колоночных](../concepts/glossary.md#column-oriented-table) и [строковых](../concepts/glossary.md#row-oriented-table) таблиц возможно только в Read-Only транзакциях. Поддержка транзакций с возможностью записи при одновременном использовании строковых и колоночных таблиц находится в разработке.

Если попытаться выполнить операцию записи в транзакции, в которой задействованы и колоночные, и строковые таблицы, транзакция завершится с ошибкой: `Write transactions between column and row tables are disabled at current time`.
12 changes: 11 additions & 1 deletion ydb/docs/ru/core/concepts/_includes/transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@

## Транзакции с участием топиков и таблиц {#topic-table-transactions}

{% note warning %}

{% include [not_allow_for_olap](../../_includes/not_allow_for_olap_text.md) %}

{% endnote %}

{{ ydb-short-name }} поддерживает транзакции с участием [строковых таблиц](../glossary.md#row-oriented-table) и/или топиков. Таким образом, можно транзакционно перекладывать данные из таблиц в топики и в обратном направлении, а также между топиками, чтобы данные не терялись и не дублировались даже в случае непредвиденных обстоятельств.

Подробнее о транзакционных операциях при работе с топиками см. в [{#T}](../topic.md#topic-transactions) и [{#T}](../../reference/ydb-sdk/topic.md).
Подробнее о транзакционных операциях при работе с топиками см. в [{#T}](../topic.md#topic-transactions) и [{#T}](../../reference/ydb-sdk/topic.md).

## Транзакции с участием строковых и столбцовых таблиц {#mixed-transactions}

{% include [limitation](../../_includes/limitation-column-row-in-read-only-tx.md) %}
2 changes: 1 addition & 1 deletion ydb/docs/ru/core/concepts/transactions.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{% include [transactions.md](_includes/transactions.md) %}
{% include [transactions.md](./_includes/transactions.md) %}
10 changes: 1 addition & 9 deletions ydb/docs/ru/core/dev/yql-tutorial/fill_tables_with_data.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
# Добавление данных в таблицы

{% note warning %}

{% include [not_allow_for_olap](../../_includes/not_allow_for_olap_text.md) %}

{% include [not_allow_for_olap](../../_includes/ways_add_data_to_olap.md) %}

{% endnote %}

Наполните данными [созданные](create_demo_tables.md) ранее строковые таблицы с помощью конструкции [REPLACE INTO](../../yql/reference/syntax/replace_into.md).
Наполните данными [созданные ранее](create_demo_tables.md) таблицы с помощью конструкции [REPLACE INTO](../../yql/reference/syntax/replace_into.md).

```yql
REPLACE INTO series (series_id, title, release_date, series_info)
Expand Down
10 changes: 2 additions & 8 deletions ydb/docs/ru/core/dev/yql-tutorial/insert_into.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
# Вставка данных с помощью INSERT

{% note warning %}
{% include [column-and-row-tables-in-read-only-tx](../../_includes/limitation-column-row-in-read-only-tx-warn.md) %}

{% include [not_allow_for_olap](../../_includes/not_allow_for_olap_text.md) %}

{% include [not_allow_for_olap](../../_includes/ways_add_data_to_olap.md) %}

{% endnote %}

Добавьте данные в строковую таблицу с помощью конструкции [INSERT INTO](../../yql/reference/syntax/insert_into.md).
Добавьте данные в таблицу с помощью конструкции [INSERT INTO](../../yql/reference/syntax/insert_into.md).

{% include [yql-reference-prerequisites](_includes/yql_tutorial_prerequisites.md) %}

Expand Down
10 changes: 2 additions & 8 deletions ydb/docs/ru/core/dev/yql-tutorial/replace_into.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
# Вставка и модификация данных с помощью REPLACE

{% note warning %}
{% include [column-and-row-tables-in-read-only-tx](../../_includes/limitation-column-row-in-read-only-tx-warn.md) %}

{% include [not_allow_for_olap](../../_includes/not_allow_for_olap_text.md) %}

{% include [not_allow_for_olap](../../_includes/ways_add_data_to_olap.md) %}

{% endnote %}

Добавьте данные в строковые таблицы с помощью конструкции [REPLACE INTO](../../yql/reference/syntax/replace_into.md).
Добавьте новые данные в таблицы с одновременным обновлением уже существующих данных с помощью конструкции [REPLACE INTO](../../yql/reference/syntax/replace_into.md).

{% include [yql-reference-prerequisites](_includes/yql_tutorial_prerequisites.md) %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,11 +485,9 @@ for i in $(seq 1 200);do echo "Line$i";done | \

#### Удаление множества записей из строковой таблицы {{ ydb-short-name }} по первичным ключам {#example-adaptive-delete-pk}

{% include [not_allow_for_olap_note](../../_includes/not_allow_for_olap_note.md) %}
Данный пример показывает, как можно удалять неограниченное количество записей из строковых таблиц {{ ydb-short-name }}, не рискуя превысить ограничения на количество записей в транзакции.

Данный пример показывает как можно удалять неограниченное количество записей из строковых таблиц {{ ydb-short-name }}, не рискуя превысить ограничения на количество записей в транзакции.

Создадим тестовую строковую таблицу:
Создайте тестовую строковую таблицу:

```bash
{{ ydb-cli }} -p quickstart yql -s 'create table test_delete_1( id UInt64 not null, primary key (id))'
Expand Down
14 changes: 2 additions & 12 deletions ydb/docs/ru/core/yql/reference/syntax/delete.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@

# DELETE FROM

{% if oss == true and backend_name == "YDB" %}
{% include [column-and-row-tables-in-read-only-tx](../../../_includes/limitation-column-row-in-read-only-tx-warn.md) %}

{% note warning %}

{% include [OLAP_not_allow_text](../../../_includes/not_allow_for_olap_text.md) %}

Вместо `DELETE FROM` для удаления данных из колоночных таблиц можно воспользоваться механизмом удаления строк по времени — [TTL](../../../concepts/ttl.md). TTL можно задать при [создании](create_table/index.md) таблицы через `CREATE TABLE` или [измененить позже](alter_table/index.md) через `ALTER TABLE`.

{% endnote %}

{% endif %}

Удаляет строки из строковой таблицы, подходящие под условия, заданные в `WHERE`.{% if feature_mapreduce %} Таблица ищется по имени в базе данных, заданной оператором [USE](use.md).{% endif %}
Удаляет строки из таблицы, подходящие под условия, заданные в `WHERE`.{% if feature_mapreduce %} Таблица ищется по имени в базе данных, заданной оператором [USE](use.md).{% endif %}

## Пример

Expand Down
14 changes: 2 additions & 12 deletions ydb/docs/ru/core/yql/reference/syntax/insert_into.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@

# INSERT INTO

{% if oss == true and backend_name == "YDB" %}

{% note warning %}

{% include [OLAP_not_allow_text](../../../_includes/not_allow_for_olap_text.md) %}

{% include [ways_add_data_to_olap](../../../_includes/ways_add_data_to_olap.md) %}

{% endnote %}

{% endif %}
{% include [column-and-row-tables-in-read-only-tx](../../../_includes/limitation-column-row-in-read-only-tx-warn.md) %}

{% if select_command != "SELECT STREAM" %}
Добавляет строки в {% if oss == true and backend_name == "YDB" %}строковую{% endif %} таблицу. {% if feature_bulk_tables %} Если целевая таблица уже существует и не является сортированной, операция `INSERT INTO` дописывает строки в конец таблицы. В случае сортированной таблицы, YQL пытается сохранить сортированность путем запуска сортированного слияния. {% endif %}{% if feature_map_tables %} При попытке вставить в таблицу строку с уже существующим значением первичного ключа операция завершится ошибкой с кодом `PRECONDITION_FAILED` и текстом `Operation aborted due to constraint violation: insert_pk`.{% endif %}
Добавляет строки в таблицу.{% if feature_bulk_tables %} Если целевая таблица уже существует и не является сортированной, операция `INSERT INTO` дописывает строки в конец таблицы. В случае сортированной таблицы, YQL пытается сохранить сортированность путем запуска сортированного слияния. {% endif %}{% if feature_map_tables %} При попытке вставить в таблицу строку с уже существующим значением первичного ключа операция завершится ошибкой с кодом `PRECONDITION_FAILED` и текстом `Operation aborted due to constraint violation: insert_pk`.{% endif %}

{% if feature_mapreduce %}Таблица по имени ищется в базе данных, заданной оператором [USE](use.md).{% endif %}

Expand Down
Loading