Skip to content

Commit 25a1b3e

Browse files
committed
Added the note
1 parent 94d65b1 commit 25a1b3e

File tree

2 files changed

+26
-22
lines changed

2 files changed

+26
-22
lines changed

ydb/docs/en/core/postgresql/import.md

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Dump data form PostgreSQL
22

3+
{% include [./_includes/alert.md](./_includes/alert_preview.md) %}
4+
35
Data from PostgreSQL can be migrated to {{ ydb-short-name }} using utilities such as [pg_dump](https://www.postgresql.org/docs/current/app-pgdump.html), [psql](https://www.postgresql.org/docs/current/app-psql.html), and [{{ ydb-short-name }} CLI](../reference/ydb-cli/index.md). The [pg_dump](https://www.postgresql.org/docs/current/app-pgdump.html) and [psql](https://www.postgresql.org/docs/current/app-psql.html) utilities are installed with PostgreSQL. [{{ ydb-short-name }} CLI](../reference/ydb-cli/index.md) is {{ ydb-short-name }}'s command-line client, which is [installed separately](../reference/ydb-cli/install.md).
46

57
To do this, you need to:
@@ -26,8 +28,8 @@ The `ydb tools pg-convert` command reads a dump file or standard input created b
2628
* Deleting the `WITH (...)` section in `CREATE TABLE`.
2729
* Commenting out unsupported constructs (optionally):
2830

29-
* `SELECT pg_catalog.set_config.*`
30-
* `ALTER TABLE`
31+
* `SELECT pg_catalog.set_config.*`
32+
* `ALTER TABLE`
3133

3234
If the CLI cannot find a table's primary key, it will automatically create a [BIGSERIAL](https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-SERIAL) column named `__ydb_stub_id` as the primary key.
3335

@@ -60,31 +62,31 @@ As an example, data generated by [pgbench](https://www.postgresql.org/docs/curre
6062

6163
1. Start Docker containers with PostgreSQL and {{ ydb-short-name }}:
6264

63-
```bash
64-
docker run -d --rm -e POSTGRES_USER=root -e POSTGRES_PASSWORD=1234 \
65-
-e POSTGRES_DB=local --name postgres postgres:14
66-
docker run --name ydb-postgres -d --pull always -p 5432:5432 -p 8765:8765 \
67-
-e POSTGRES_USER=root -e POSTGRES_PASSWORD=1234 \
68-
-e YDB_FEATURE_FLAGS=enable_temp_tables,enable_table_pg_types \
69-
-e YDB_USE_IN_MEMORY_PDISKS=true \
70-
ghcr.io/ydb-platform/local-ydb:latest
71-
```
65+
```bash
66+
docker run -d --rm -e POSTGRES_USER=root -e POSTGRES_PASSWORD=1234 \
67+
-e POSTGRES_DB=local --name postgres postgres:14
68+
docker run --name ydb-postgres -d --pull always -p 5432:5432 -p 8765:8765 \
69+
-e POSTGRES_USER=root -e POSTGRES_PASSWORD=1234 \
70+
-e YDB_FEATURE_FLAGS=enable_temp_tables,enable_table_pg_types \
71+
-e YDB_USE_IN_MEMORY_PDISKS=true \
72+
ghcr.io/ydb-platform/local-ydb:latest
73+
```
7274

7375
2. Generate data through [pgbench](https://www.postgresql.org/docs/current/pgbench.html):
7476

75-
```bash
76-
docker exec postgres pgbench postgres://root:1234@localhost/local -i
77-
```
77+
```bash
78+
docker exec postgres pgbench postgres://root:1234@localhost/local -i
79+
```
7880

7981
3. Create a dump of the database using [pg_dump](https://www.postgresql.org/docs/current/app-pgdump.html):
8082

81-
```bash
82-
docker exec postgres pg_dump postgres://root:1234@localhost/local --inserts \
83-
--column-inserts --encoding=utf_8 --rows-per-insert=1000 > dump.sql
84-
```
83+
```bash
84+
docker exec postgres pg_dump postgres://root:1234@localhost/local --inserts \
85+
--column-inserts --encoding=utf_8 --rows-per-insert=1000 > dump.sql
86+
```
8587

86-
4. Load the dump into {{ ydb-short-name }}:
88+
4. Load the dump into {{ ydb-short-name }}:
8789

88-
```bash
89-
ydb tools pg-convert --ignore-unsupported -i dump.sql | psql postgresql://root:1234@localhost/local
90-
```
90+
```bash
91+
ydb tools pg-convert --ignore-unsupported -i dump.sql | psql postgresql://root:1234@localhost/local
92+
```

ydb/docs/ru/core/postgresql/import.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Импорт данных из PostgreSQL
22

3+
{% include [./_includes/alert.md](./_includes/alert_preview.md) %}
4+
35
Данные из PostgreSQL в {{ ydb-name }} можно импортировать различными способами:
46

57
- С помощью [pg-dump](#pg-dump).

0 commit comments

Comments
 (0)