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():
1111 async with aiopg .create_pool () as pool :
1212 # Create Cursor via Connection
1313 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"
1616
1717 # Create Cursor directly
1818 async with pool .cursor () as cur :
1919 await cur .execute ("sql" ) # $ getSql="sql" constructedSql="sql"
2020
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
2128from aiopg .sa import create_engine
2229
2330async def test_engine ():
You can’t perform that action at this time.
0 commit comments