mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
Apply suggestions from code review
Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
This commit is contained in:
@@ -11,13 +11,20 @@ async def test_cursor():
|
||||
async with aiopg.create_pool() as pool:
|
||||
# Create Cursor via Connection
|
||||
async with pool.acquire() as conn:
|
||||
cur = await conn.cursor()
|
||||
await cur.execute("sql") # $ getSql="sql" constructedSql="sql"
|
||||
async with conn.cursor() as cur:
|
||||
await cur.execute("sql") # $ getSql="sql" constructedSql="sql"
|
||||
|
||||
# Create Cursor directly
|
||||
async with pool.cursor() as cur:
|
||||
await cur.execute("sql") # $ getSql="sql" constructedSql="sql"
|
||||
|
||||
# variants using as few `async with` as possible
|
||||
pool = await aiopg.create_pool()
|
||||
conn = pool.acquire()
|
||||
cur = await conn.cursor()
|
||||
await cur.execute("sql") # $ getSql="sql" constructedSql="sql"
|
||||
|
||||
# Test SQLAlchemy integration
|
||||
from aiopg.sa import create_engine
|
||||
|
||||
async def test_engine():
|
||||
|
||||
Reference in New Issue
Block a user