File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
python/ql/test/library-tests/frameworks/aiopg Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -11,13 +11,20 @@ async def test_cursor():
11
11
async with aiopg .create_pool () as pool :
12
12
# Create Cursor via Connection
13
13
async with pool .acquire () as conn :
14
- cur = await conn .cursor ()
15
- await cur .execute ("sql" ) # $ getSql="sql" constructedSql="sql"
14
+ async with conn .cursor () as cur :
15
+ await cur .execute ("sql" ) # $ getSql="sql" constructedSql="sql"
16
16
17
17
# Create Cursor directly
18
18
async with pool .cursor () as cur :
19
19
await cur .execute ("sql" ) # $ getSql="sql" constructedSql="sql"
20
20
21
+ # variants using as few `async with` as possible
22
+ pool = await aiopg .create_pool ()
23
+ conn = pool .acquire ()
24
+ cur = await conn .cursor ()
25
+ await cur .execute ("sql" ) # $ getSql="sql" constructedSql="sql"
26
+
27
+ # Test SQLAlchemy integration
21
28
from aiopg .sa import create_engine
22
29
23
30
async def test_engine ():
You can’t perform that action at this time.
0 commit comments