Skip to content
Merged
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
1 change: 1 addition & 0 deletions ydb/docs/ru/core/_includes/feature-not-supported.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Функциональность на данный момент не поддерживается.
1 change: 0 additions & 1 deletion ydb/docs/ru/core/_includes/work-in-progress.md

This file was deleted.

10 changes: 10 additions & 0 deletions ydb/docs/ru/core/recipes/ydb-sdk/auth-access-token.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,16 @@
await using var driver = await Driver.CreateInitialized(config);
```

- Rust

```rust
use ydb::{AccessTokenCredentials, ClientBuilder, YdbResult};

let client = ClientBuilder::new_from_connection_string("grpc://localhost:2136?database=local")?
.with_credentials(AccessTokenCredentials::from(std::env::var("YDB_TOKEN")?))
.client()?;
```

- PHP

```php
Expand Down
10 changes: 10 additions & 0 deletions ydb/docs/ru/core/recipes/ydb-sdk/auth-anonymous.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,16 @@
await using var driver = await Driver.CreateInitialized(config);
```

- Rust

```rust
use ydb::{AnonymousCredentials, ClientBuilder, YdbResult};
let client = ClientBuilder::new_from_connection_string("grpc://localhost:2136?database=local")?
.with_credentials(AnonymousCredentials::new())
.client()?;
```

- PHP

```php
Expand Down
10 changes: 10 additions & 0 deletions ydb/docs/ru/core/recipes/ydb-sdk/auth-env.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,16 @@

{% endlist %}

- Rust

```rust
use ydb::{ClientBuilder, FromEnvCredentials, YdbResult};
let client = ClientBuilder::new_from_connection_string(std::env::var("YDB_CONNECTION_STRING")?)?
.with_credentials(FromEnvCredentials::new()?)
.client()?;
```

- PHP

```php
Expand Down
10 changes: 10 additions & 0 deletions ydb/docs/ru/core/recipes/ydb-sdk/auth-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,16 @@
await using var driver = await Driver.CreateInitialized(config);
```

- Rust

```rust
use ydb::{ClientBuilder, MetadataUrlCredentials, YdbResult};
let client = ClientBuilder::new_from_connection_string("grpc://localhost:2136?database=local")?
.with_credentials(MetadataUrlCredentials::new())
.client()?;
```

- PHP

```php
Expand Down
10 changes: 10 additions & 0 deletions ydb/docs/ru/core/recipes/ydb-sdk/auth-service-account.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,16 @@
await using var driver = await Driver.CreateInitialized(config);
```

- Rust

```rust
use ydb::{ClientBuilder, ServiceAccountCredentials, YdbResult};
let client = ClientBuilder::new_from_connection_string(std::env::var("YDB_CONNECTION_STRING")?)?
.with_credentials(ServiceAccountCredentials::from_env()?)
.client()?;
```

- PHP

```php
Expand Down
15 changes: 15 additions & 0 deletions ydb/docs/ru/core/recipes/ydb-sdk/auth-static.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,21 @@
await using var driver = await Driver.CreateInitialized(config);
```

- Rust

```rust
use ydb::{ClientBuilder, StaticCredentials, YdbResult};

let client = ClientBuilder::new_from_connection_string("grpc://localhost:2136?database=local")?
.with_credentials(StaticCredentials::new(
std::env::var("YDB_USER")?,
std::env::var("YDB_PASSWORD")?,
http::Uri::from_static("grpc://localhost:2136"),
"local".into(),
))
.client()?;
```

- PHP

```php
Expand Down
10 changes: 9 additions & 1 deletion ydb/docs/ru/core/recipes/ydb-sdk/balancing-prefer-local.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@

- JavaScript

{% include [work-in-progress](../../_includes/work-in-progress.md) %}
{% include [feature-not-supported](../../_includes/feature-not-supported.md) %}

- Java

Expand All @@ -197,4 +197,12 @@

{% endlist %}

- Rust

{% include [feature-not-supported](../../_includes/feature-not-supported.md) %}

- PHP

{% include [feature-not-supported](../../_includes/feature-not-supported.md) %}

{% endlist %}
12 changes: 10 additions & 2 deletions ydb/docs/ru/core/recipes/ydb-sdk/balancing-prefer-location.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@

- Python

Функциональность на данный момент не поддерживается.
{% include [feature-not-supported](../../_includes/feature-not-supported.md) %}

- JavaScript

{% include [work-in-progress](../../_includes/work-in-progress.md) %}
{% include [feature-not-supported](../../_includes/feature-not-supported.md) %}

- Java

Expand Down Expand Up @@ -146,4 +146,12 @@

{% endlist %}

- Rust

{% include [feature-not-supported](../../_includes/feature-not-supported.md) %}

- PHP

{% include [feature-not-supported](../../_includes/feature-not-supported.md) %}

{% endlist %}
16 changes: 12 additions & 4 deletions ydb/docs/ru/core/recipes/ydb-sdk/balancing-prefer-pile.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

- Go

Функциональность на данный момент не поддерживается.
{% include [feature-not-supported](../../_includes/feature-not-supported.md) %}

- С++

Expand All @@ -32,14 +32,22 @@

- Python

Функциональность на данный момент не поддерживается.
{% include [feature-not-supported](../../_includes/feature-not-supported.md) %}

- JavaScript

{% include [work-in-progress](../../_includes/work-in-progress.md) %}
{% include [feature-not-supported](../../_includes/feature-not-supported.md) %}

- Java

Функциональность на данный момент не поддерживается.
{% include [feature-not-supported](../../_includes/feature-not-supported.md) %}

- Rust

{% include [feature-not-supported](../../_includes/feature-not-supported.md) %}

- PHP

{% include [feature-not-supported](../../_includes/feature-not-supported.md) %}

{% endlist %}
10 changes: 9 additions & 1 deletion ydb/docs/ru/core/recipes/ydb-sdk/balancing-random-choice.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@

- JavaScript

{% include [work-in-progress](../../_includes/work-in-progress.md) %}
{% include [feature-not-supported](../../_includes/feature-not-supported.md) %}

- Java

Expand Down Expand Up @@ -195,4 +195,12 @@

{% endlist %}

- Rust

{% include [feature-not-supported](../../_includes/feature-not-supported.md) %}

- PHP

{% include [feature-not-supported](../../_includes/feature-not-supported.md) %}

{% endlist %}
80 changes: 70 additions & 10 deletions ydb/docs/ru/core/recipes/ydb-sdk/bulk-upsert.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,14 @@
```java
private static final String TABLE_NAME = "bulk_upsert";
private static final int BATCH_SIZE = 1000;

public static void main(String[] args) {
String connectionString = args[0];

try (GrpcTransport transport = GrpcTransport.forConnectionString(connectionString)
.withAuthProvider(NopAuthProvider.INSTANCE) // анонимная аутентификация
.build()) {

// Для bulk upsert необходимо использовать полный путь к таблице
String tablePath = transport.getDatabase() + "/" + TABLE_NAME;
try (TableClient tableClient = TableClient.newClient(transport).build()) {
Expand All @@ -257,7 +257,7 @@
}
}
}

public static void execute(SessionRetryContext retryCtx, String tablePath) {
// описание таблицы
StructType structType = StructType.of(
Expand All @@ -267,7 +267,7 @@
"http_code", PrimitiveType.Uint32,
"message", PrimitiveType.Text
);

// генерация пакета записей
List<Value<?>> list = new ArrayList<>(50);
for (int i = 0; i < BATCH_SIZE; i += 1) {
Expand All @@ -280,7 +280,7 @@
"message", PrimitiveValue.newText(i % 3 == 0 ? "GET / HTTP/1.1" : "GET /images/logo.png HTTP/1.1")
));
}

// Create list of structs
ListValue rows = ListType.of(structType).newValue(list);
// Do retry operation on errors with best effort
Expand All @@ -294,10 +294,10 @@

```java
private static final int BATCH_SIZE = 1000;

public static void main(String[] args) {
String connectionUrl = args[0];

try (Connection conn = DriverManager.getConnection(connectionUrl)) {
try (PreparedStatement ps = conn.prepareStatement(
"BULK UPSERT INTO bulk_upsert (app, timestamp, host, http_code, message) VALUES (?, ?, ?, ?, ?);"
Expand All @@ -310,7 +310,7 @@
ps.setString(5, i % 3 == 0 ? "GET / HTTP/1.1" : "GET /images/logo.png HTTP/1.1");
ps.addBatch();
}

ps.executeBatch();
}
} catch (SQLException e) {
Expand Down Expand Up @@ -411,6 +411,66 @@

- JavaScript

{% include [work-in-progress](../../_includes/work-in-progress.md) %}
{% include [feature-not-supported](../../_includes/feature-not-supported.md) %}

- Rust

```rust
use ydb::{ydb_struct, AccessTokenCredentials, ClientBuilder, Value, YdbResult};

#[tokio::main]
async fn main() -> YdbResult<()> {
let client = ClientBuilder::new_from_connection_string(
"grpc://localhost:2136?database=local",
)?
.with_credentials(AccessTokenCredentials::from("..."))
.client()?;

client.wait().await?;

let rows: Vec<Value> = vec![
ydb_struct!(
"id" => 1_u64,
"val" => Value::Text("1".into()),
),
ydb_struct!(
"id" => 2_u64,
"val" => Value::Text("2".into()),
),
ydb_struct!(
"id" => 3_u64,
"val" => Value::Text("3".into()),
),
];

client
.table_client()
.retry_execute_bulk_upsert("/local/tablename".into(), rows)
.await?;

Ok(())
}
```

- PHP

```php
<?php

use YdbPlatform\Ydb\Ydb;

$ydb = new Ydb($config);

$rows = [
['id' => 1, 'val' => '1'],
['id' => 2, 'val' => '2'],
['id' => 3, 'val' => '3'],
];

$ydb->table()->bulkUpsert('tablename', $rows, [
'id' => 'UINT64',
'val' => 'UTF8',
]);
```

{% endlist %}
14 changes: 11 additions & 3 deletions ydb/docs/ru/core/recipes/ydb-sdk/debug-jaeger.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,22 @@

- Java

Функциональность на данный момент не поддерживается.
{% include [feature-not-supported](../../_includes/feature-not-supported.md) %}

- Python

Функциональность на данный момент не поддерживается.
{% include [feature-not-supported](../../_includes/feature-not-supported.md) %}

- JavaScript

{% include [work-in-progress](../../_includes/work-in-progress.md) %}
{% include [feature-not-supported](../../_includes/feature-not-supported.md) %}

- Rust

{% include [feature-not-supported](../../_includes/feature-not-supported.md) %}

- PHP

{% include [feature-not-supported](../../_includes/feature-not-supported.md) %}

{% endlist %}
Loading
Loading