Add named collections to remote table function docs

This commit is contained in:
Aliaksei Khatskevich 2023-12-04 18:39:08 +01:00
parent 741757634f
commit c3f1d0259a
No known key found for this signature in database
GPG Key ID: 425671209BCA14C0
2 changed files with 19 additions and 6 deletions

View File

@ -9,7 +9,7 @@ sidebar_label: fuzzJSON
Perturbs a JSON string with random variations.
``` sql
fuzzJSON({ named_collection [option=value [,..]] | json_str[, random_seed] })
fuzzJSON({ named_collection [, option=value [,..]] | json_str[, random_seed] })
```
**Arguments**

View File

@ -13,10 +13,12 @@ Both functions can be used in `SELECT` and `INSERT` queries.
## Syntax
``` sql
remote('addresses_expr', [db, table, 'user'[, 'password'], sharding_key])
remote('addresses_expr', [db.table, 'user'[, 'password'], sharding_key])
remoteSecure('addresses_expr', [db, table, 'user'[, 'password'], sharding_key])
remoteSecure('addresses_expr', [db.table, 'user'[, 'password'], sharding_key])
remote(addresses_expr, [db, table, user [, password], sharding_key])
remote(addresses_expr, [db.table, user [, password], sharding_key])
remote(named_collection[, option=value [,..]])
remoteSecure(addresses_expr, [db, table, user [, password], sharding_key])
remoteSecure(addresses_expr, [db.table, user [, password], sharding_key])
remoteSecure(named_collection[, option=value [,..]])
```
## Parameters
@ -39,6 +41,8 @@ remoteSecure('addresses_expr', [db.table, 'user'[, 'password'], sharding_key])
- `password` — User password. If not specified, an empty password is used. Type: [String](../../sql-reference/data-types/string.md).
- `sharding_key` — Sharding key to support distributing data across nodes. For example: `insert into remote('127.0.0.1:9000,127.0.0.2', db, table, 'default', rand())`. Type: [UInt32](../../sql-reference/data-types/int-uint.md).
Arguments also can be passed using [named collections](/docs/en/operations/named-collections.md).
## Returned value
A table located on a remote server.
@ -82,7 +86,16 @@ example01-01-1,example01-02-1
SELECT * FROM remote('127.0.0.1', db.remote_engine_table) LIMIT 3;
```
### Inserting data from a remote server into a table:
Or using [named collections](/docs/en/operations/named-collections.md):
```sql
CREATE NAMED COLLECTION creds AS
host = '127.0.0.1',
database = 'db';
SELECT * FROM remote(creds, table='remote_engine_table') LIMIT 3;
```
### Inserting data into a table on a remote server:
``` sql
CREATE TABLE remote_table (name String, value UInt32) ENGINE=Memory;