@@ -53,7 +53,7 @@ import testgres
53
53
with testgres.get_new_node(' test' ) as node:
54
54
node.init() # run initdb
55
55
node.start() # start PostgreSQL
56
- print (node.execute (' postgres' , ' select 1' ))
56
+ print (await node.fetch (' postgres' , ' select 1' ))
57
57
node.stop() # stop PostgreSQL
58
58
```
59
59
@@ -93,10 +93,10 @@ Finally, our temporary cluster is able to process queries. There are four ways t
93
93
94
94
The last one is the most powerful: you can use ` begin(isolation_level) ` , ` commit() ` and ` rollback() ` :
95
95
``` python
96
- with node.connect() as con:
97
- con.begin(' serializable' )
98
- print (con.execute (' select %s ' , 1 ))
99
- con.rollback()
96
+ async with node.connect() as con:
97
+ await con.begin(' serializable' )
98
+ print (await con.fetch (' select %s ' , 1 ))
99
+ await con.rollback()
100
100
```
101
101
102
102
To stop the server, run:
@@ -115,7 +115,7 @@ with testgres.get_new_node('master') as master:
115
115
master.init().start()
116
116
with master.backup() as backup:
117
117
replica = backup.spawn_replica(' replica' ).start()
118
- print (replica.execute (' postgres' , ' select 1' ))
118
+ print (await replica.fetch (' postgres' , ' select 1' ))
119
119
```
120
120
121
121
> Note: you could take a look at [ ` pg_pathman ` ] ( https://github.com/postgrespro/pg_pathman ) to get an idea of ` testgres ` ' capabilities.
0 commit comments