Skip to content

Commit 911787a

Browse files
authored
Backport ydb sql documentation to stable-25-2 (#26240)
2 parents 5f64a56 + 7567ae6 commit 911787a

37 files changed

+1488
-70
lines changed

ydb/docs/en/core/devops/deployment-options/kubernetes/initial-deployment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ Check how {{ ydb-short-name }} works:
251251
ydb \
252252
--endpoint grpc://database-sample-grpc:2135 \
253253
--database /root/database-sample \
254-
table query execute --query 'SELECT 2 + 2;'
254+
sql -s 'SELECT 2 + 2;'
255255
```
256256

257257
* `--endpoint`: The database endpoint.

ydb/docs/en/core/recipes/ydb-cli/ttl.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ To enable data eviction, an [external data source](../../concepts/datamodel/exte
2525
The example below shows how to enable data eviction by executing a YQL-query from {{ ydb-short-name }} CLI. Rows of the table `mytable` will be moved to the bucket described in the external data source `/Root/s3_cold_data` one hour after the time recorded in the column `created_at` and will be deleted after 24 hours.
2626

2727
```bash
28-
$ {{ ydb-cli }} -e <endpoint> -d <database> table query execute -q '
28+
$ {{ ydb-cli }} -e <endpoint> -d <database> sql -s '
2929
ALTER TABLE `mytable` SET (
3030
TTL =
3131
Interval("PT1H") TO EXTERNAL DATA SOURCE `/Root/s3_cold_data`,

ydb/docs/en/core/reference/kafka-api/examples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Currently, the only available authentication mechanism with Kafka API in {{ ydb-
110110

111111
To use authentication in a multinode self-deployed database:
112112

113-
1. Create a user. [How to do this in YQL](../../yql/reference/syntax/create-user.md). [How to execute YQL from CLI](../ydb-cli/yql.md).
113+
1. Create a user. [How to do this in YQL](../../yql/reference/syntax/create-user.md). [How to execute YQL from CLI](../ydb-cli/sql.md).
114114
2. Connect to the Kafka API as shown in the examples below. In all examples, it is assumed that:
115115

116116
- YDB is running locally with the environment variable `YDB_KAFKA_PROXY_PORT=9092`, meaning that the Kafka API is available at `localhost:9092`. For example, you can run YDB in Docker as described [here](../../quickstart.md#install).

ydb/docs/en/core/reference/ydb-cli/_includes/commands.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,16 @@ Any command can be run from the command line with the `--help` option to get hel
5252
| [scheme permissions clear-inheritance](../commands/scheme-permissions.md#clear-inheritance) | Disable permission inheritance |
5353
| [scheme permissions set-inheritance](../commands/scheme-permissions.md#set-inheritance) | Enable permission inheritance |
5454
| [scheme rmdir](../commands/dir.md#rmdir) | Deleting a directory |
55-
| [scripting yql](../scripting-yql.md) | Executing a YQL script |
55+
| [scripting yql](../scripting-yql.md) | Executing a YQL script (deprecated, use [`ydb sql`](../sql.md)) |
56+
| [sql](../sql.md) | Execute any query |
5657
| table attribute add | Adding a table attribute |
5758
| table attribute drop | Deleting a table attribute |
5859
| [table drop](../table-drop.md) | Deleting a table |
5960
| [table index add global-async](../commands/secondary_index.md#add) | Adding an asynchronous index |
6061
| [table index add global-sync](../commands/secondary_index.md#add) | Adding a synchronous index |
6162
| [table index drop](../commands/secondary_index.md#drop) | Deleting an index |
62-
| [table query execute](../table-query-execute.md) | Executing a YQL query |
63-
| [table query explain](../commands/explain-plan.md) | YQL query execution plan |
63+
| [table query execute](../table-query-execute.md) | Executing a YQL query (deprecated, use [`ydb sql`](../sql.md)) |
64+
| [table query explain](../commands/explain-plan.md) | YQL query execution plan (deprecated, use [`ydb sql --explain`](../sql.md)) |
6465
| [table read](../commands/readtable.md) | Streaming table reads |
6566
| [table ttl set](../table-ttl-set.md) | Setting TTL parameters |
6667
| [table ttl reset](../table-ttl-reset.md) | Resetting TTL parameters |
@@ -77,8 +78,8 @@ Any command can be run from the command line with the `--help` option to get hel
7778
| [topic read](../topic-read.md) | Reading messages from a topic |
7879
| [topic write](../topic-write.md) | Writing messages to a topic |
7980
{% if ydb-cli == "ydb" %}
80-
[update](../commands/service.md) | Update the {{ ydb-short-name }} CLI
81-
[version](../commands/service.md) | Output details about the {{ ydb-short-name }} CLI version
81+
| [update](../commands/service.md) | Update the {{ ydb-short-name }} CLI |
82+
| [version](../commands/service.md) | Output details about the {{ ydb-short-name }} CLI version |
8283
{% endif %}
83-
[workload](../commands/workload/index.md) | Generate the workload
84-
[yql](../yql.md) | Execute a YQL script (with streaming support)
84+
| [workload](../commands/workload/index.md) | Generate the workload |
85+
| [yql](../yql.md) | Execute a YQL script (deprecated, use [`ydb sql`](../sql.md)) |
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{% note warning %}
2+
3+
This command is deprecated.
4+
The preferred way to run queries in {{ ydb-short-name }} CLI is to use the [`{{ ydb-cli }} sql`](../sql.md) command.
5+
6+
{% endnote %}

ydb/docs/en/core/reference/ydb-cli/_includes/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ For a full description of {{ ydb-short-name }} CLI commands, see the following a
99
* [List of objects](../commands/scheme-ls.md).
1010
* [Getting information about schema objects](../commands/scheme-describe.md).
1111
* [Working with directories](../commands/dir.md).
12-
* [YQL execution](../yql-query-overview.md).
12+
* [Query execution](../yql-query-overview.md).
1313
* [Streaming table reads](../commands/readtable.md).
1414
* [Working with secondary indexes](../commands/secondary_index.md).
1515
* [Getting a list of DB endpoints](../commands/discovery-list.md).

ydb/docs/en/core/reference/ydb-cli/commands/_includes/scan-query.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Performing scan queries
22

3+
{% include notitle [warning](../../_includes/deprecated_command_warning.md) %}
4+
35
You can run a query using [Scan Queries](../../../../concepts/scan_query.md) via the {{ ydb-short-name }} CLI by adding the `-t scan` flag to the `{{ ydb-cli }} table query execute` command.
46

57
Run the data query:

ydb/docs/en/core/reference/ydb-cli/commands/scheme-permissions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Additional parameters `[options...]`:
5151
Each right must be passed as a separate parameter, for example:
5252

5353
```bash
54-
{{ ydb-cli }} scheme permissions grant -p "ydb.access.grant" -p "ydb.generic.read" '/Root/db1/MyApp/Orders' testuser
54+
{{ ydb-cli }} scheme permissions grant -p "ydb.access.grant" -p "ydb.generic.read" '/Root/db1/MyApp/Orders' testuser
5555
```
5656

5757
## set
@@ -129,7 +129,7 @@ Parameters:
129129
For example, if you execute the command over the database state from the previous example [`list`](#list):
130130

131131
```bash
132-
{{ ydb-cli }} scheme permissions clear '/Root/db1/MyApp'
132+
{{ ydb-cli }} scheme permissions clear '/Root/db1/MyApp'
133133
```
134134

135135
And then execute the `list` command again on the object `/Root/db1/MyApp`, you will get the following result:

ydb/docs/en/core/reference/ydb-cli/parameterized-queries-cli.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2+
{% note warning %}
3+
4+
This page is outdated. Please refer to [{#T}](parameterized-query-execution.md) for up-to-date information.
5+
6+
{% endnote %}
7+
18
# Running parametrized YQL queries and scripts
29

310
## Overview
@@ -53,7 +60,7 @@ echo '{"a":10}' > p1.json
5360
{{ ydb-cli }} -p quickstart table query execute -q 'declare $a as Int64;select $a' --param-file p1.json
5461
```
5562

56-
Through `stdin`:
63+
Via `stdin`:
5764

5865
```bash
5966
echo '{"a":10}' | {{ ydb-cli }} -p quickstart table query execute -q 'declare $a as Int64;select $a'
@@ -293,7 +300,7 @@ Command output:
293300
This example demonstrates the adaptive batching triggered by a processing delay. In the first line of the command below, we generate 1,000 rows at a delay of 0.2 seconds on `stdout` and pipe them to `stdin` to the YQL query execution command. The YQL query execution command shows the parameter batches in each subsequent YQL query call.
294301

295302
```bash
296-
for i in $(seq 1 1000);do echo "Line$i";sleep 0.2;done | \
303+
for i in $(seq 1 1000); do echo "Line$i"; sleep 0.2; done | \
297304
{{ ydb-cli }} -p quickstart table query execute \
298305
-q 'DECLARE $x AS List<Utf8>;
299306
SELECT ListLength($x), $x' \
@@ -335,7 +342,7 @@ This example demonstrates the adaptive batching triggered by a number of paramet
335342
In this example, we also demonstrate the option to join parameters from different sources and generate JSON at the output.
336343

337344
```bash
338-
for i in $(seq 1 200);do echo "Line$i";done | \
345+
for i in $(seq 1 200); do echo "Line$i"; done | \
339346
{{ ydb-cli }} -p quickstart table query execute \
340347
-q 'DECLARE $x AS List<Utf8>;
341348
DECLARE $p2 AS Int64;
@@ -372,7 +379,7 @@ Let's create a test table:
372379
Add 100,000 records to it:
373380

374381
```bash
375-
for i in $(seq 1 100000);do echo "$i";done | \
382+
for i in $(seq 1 100000); do echo "$i"; done | \
376383
{{ ydb-cli }} -p quickstart import file csv -p test_delete_1
377384
```
378385

0 commit comments

Comments
 (0)