|
7 | 7 | edit configuration files, start/stop cluster, execute queries. The
|
8 | 8 | typical flow may look like:
|
9 | 9 |
|
10 |
| ->>> with get_new_node() as node: |
| 10 | +>>> with get_new_node('test') as node: |
11 | 11 | ... node.init().start()
|
12 | 12 | ... result = node.safe_psql('postgres', 'select 1')
|
13 | 13 | ... print(result.decode('utf-8').strip())
|
14 | 14 | ... node.stop()
|
15 |
| -<testgres.node.PostgresNode object at 0x...> |
| 15 | +PostgresNode('test', port=..., base_dir=...) |
16 | 16 | 1
|
17 |
| -<testgres.node.PostgresNode object at 0x...> |
| 17 | +PostgresNode('test', port=..., base_dir=...) |
18 | 18 |
|
19 | 19 | Or:
|
20 | 20 |
|
21 |
| ->>> with get_new_node() as master: |
| 21 | +>>> with get_new_node('master') as master: |
22 | 22 | ... master.init().start()
|
23 | 23 | ... with master.backup() as backup:
|
24 |
| -... with backup.spawn_replica() as replica: |
| 24 | +... with backup.spawn_replica('replica') as replica: |
25 | 25 | ... replica = replica.start()
|
26 | 26 | ... master.execute('postgres', 'create table test (val int4)')
|
27 | 27 | ... master.execute('postgres', 'insert into test values (0), (1), (2)')
|
28 | 28 | ... replica.catchup() # wait until changes are visible
|
29 | 29 | ... print(replica.execute('postgres', 'select count(*) from test'))
|
30 |
| -<testgres.node.PostgresNode object at 0x...> |
| 30 | +PostgresNode('master', port=..., base_dir=...) |
31 | 31 | [(3,)]
|
32 | 32 |
|
33 | 33 | Copyright (c) 2016, Postgres Professional
|
|
0 commit comments