Skip to content

Commit 73fe127

Browse files
authored
Merge 3ef0155 into a435e8c
2 parents a435e8c + 3ef0155 commit 73fe127

File tree

6 files changed

+67
-0
lines changed

6 files changed

+67
-0
lines changed

ydb/docs/en/core/yql/reference/syntax/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* [CREATE TABLE](create_table/index.md)
2222
* [DROP TABLE](drop_table.md)
2323
* [INSERT](insert_into.md)
24+
* [SHOW CREATE](show_create.md)
2425

2526
{% if feature_map_tables %}
2627

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# SHOW CREATE
2+
3+
4+
`SHOW CREATE` returns a query (possibly consisting of several SQL statements) required to recreate the structure of the specified object: {% if concept_table %}[table]({{ concept_table }}){% else %}table{% endif %} (TABLE) or [view](../../../concepts/datamodel/view.md) (VIEW).
5+
6+
### Syntax
7+
8+
```yql
9+
SHOW CREATE [TABLE|VIEW] <name>;
10+
```
11+
12+
### Parameters
13+
14+
* `TABLE|VIEW` — The object type: `TABLE` for a table or `VIEW` for a view.
15+
* `<name>` — The object name. An absolute path may also be specified.
16+
17+
## Result
18+
19+
The command always returns **exactly one row** with three columns:
20+
21+
| TablePath | TableType | CreateTableQuery |
22+
|-----------------|------------|----------------------------------|
23+
| Absolute path | Table/View | SQL DDL statements for creation |
24+
25+
- **TablePath** — The absolute path to the object (e.g., `/Root/MyTable` or `/Root/MyView`).
26+
- **TableType** — The type of object: `Table` or `View`.
27+
- **CreateTableQuery** — The complete set of DDL statements needed to recreate the object:
28+
- For tables: the main [CREATE TABLE](create_table/index.md) statement (with the path relative to the database), plus any additional statements describing the current configuration, such as:
29+
- [ALTER TABLE ... ALTER INDEX](alter_table/indexes#altering-an-index-alter-index) — for index partitioning settings.
30+
- [ALTER TABLE ... ADD CHANGEFEED](alter_table/changefeed.md) — for adding a change feed.
31+
- `ALTER SEQUENCE` — for restoring a `Sequence` state for `Serial` columns.
32+
- For views: the definition via [CREATE VIEW](create-view.md), and, if necessary, the output of [PRAGMA TablePathPrefix](pragma#tablepathprefix-table-path-prefix).

ydb/docs/en/core/yql/reference/syntax/toc_i.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ items:
4242
- { name: SELECT, include: { mode: link, path: select/toc_p.yaml } }
4343
- { name: SELECT STREAM, href: select_stream.md, when: feature_mapreduce and process_command == "PROCESS STREAM" }
4444
- { name: SUBQUERY, href: subquery.md, when: feature_subquery }
45+
- { name: SHOW CREATE, href: show_create.md }
4546
- { name: UPDATE, href: update.md, when: feature_map_tables }
4647
- { name: UPSERT, href: upsert_into.md, when: feature_upsert }
4748
- { name: USE, href: use.md, when: feature_mapreduce }

ydb/docs/ru/core/yql/reference/syntax/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* [CREATE TABLE](create_table/index.md)
2222
* [DROP TABLE](drop_table.md)
2323
* [INSERT](insert_into.md)
24+
* [SHOW CREATE](show_create.md)
2425

2526
{% if feature_map_tables %}
2627

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# SHOW CREATE
2+
3+
`SHOW CREATE` возвращает запрос, возможно состоящий из нескольких SQL-стейтментов, необходимых для воссоздания структуры выбранного объекта: {% if concept_table %}[таблицы]({{ concept_table }}){% else %}таблицы{% endif %} (`TABLE`) или [представления](../../../concepts/datamodel/view.md) (`VIEW`).
4+
5+
### Синтаксис:
6+
7+
```yql
8+
SHOW CREATE [TABLE|VIEW] <name>;
9+
```
10+
### Параметры
11+
12+
* `TABLE|VIEW` - тип объекта: `TABLE` для таблицы или `VIEW` для представления.
13+
* `<name>` - имя объекта, также может быть указан абсолютный путь.
14+
15+
## Результат выполнения
16+
17+
Команда возвращает **ровно одну строку** с тремя колонками:
18+
19+
| TablePath | TableType | CreateTableQuery |
20+
|-----------------|-----------|-----------------------------|
21+
| Абсолютный путь | Table/View| SQL-стейтменты для создания |
22+
23+
- **TablePath** — абсолютный путь к объекту (например, `/Root/MyTable` или `/Root/MyView`).
24+
- **TableType** — тип объекта: `Table` или `View`.
25+
- **CreateTableQuery** — полный набор DDL-стейтментов, необходимых для воссоздания объекта:
26+
- Для таблиц: основной оператор [CREATE TABLE](create_table/index.md) (с путем относительно базы), а также дополнительные команды, необходимые для описания текущего состояния и настроек:
27+
- [ALTER TABLE ... ALTER INDEX](alter_table/indexes#изменение-параметров-индекса-alter-index)— для задания настроек партицирования вторичных индексов.
28+
- [ALTER TABLE ... ADD CHANGEFEED](alter_table/changefeed.md)— для добавления потока изменений.
29+
- `ALTER SEQUENCE` — для восстановления состояния `Sequence` у колонок типа [Serial](../../../yql/reference/types/serial.md).
30+
- Для представлений: определение посредством команды [CREATE VIEW](create-view.md), а также, если необходимо, вывода [PRAGMA TablePathPrefix](pragma#tablepathprefix-table-path-prefix).
31+

ydb/docs/ru/core/yql/reference/syntax/toc_i.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ items:
5555
- { name: REVOKE, href: revoke.md, when: feature_user_and_group }
5656
- { name: SELECT, include: { mode: link, path: select/toc_p.yaml } }
5757
- { name: SELECT STREAM, href: select_stream.md, when: feature_mapreduce and process_command == "PROCESS STREAM" }
58+
- { name: SHOW CREATE, href: show_create.md }
5859
- { name: SUBQUERY, href: subquery.md, when: feature_subquery }
5960
- { name: UPDATE, href: update.md, when: feature_map_tables }
6061
- { name: UPSERT, href: upsert_into.md, when: feature_upsert }

0 commit comments

Comments
 (0)