Skip to content

Commit a5c6952

Browse files
committed
Fixing LGTM warning about aiosqlite imports
1 parent b6bc76e commit a5c6952

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

piccolo/engine/sqlite.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
import typing as t
99
import uuid
1010

11-
import aiosqlite
12-
from aiosqlite import Cursor, Connection
11+
from aiosqlite import connect, Connection, Cursor
1312

1413
from piccolo.engine.base import Batch, Engine
1514
from piccolo.engine.exceptions import TransactionError
@@ -353,7 +352,7 @@ async def batch(self, query: Query, batch_size: int = 100) -> AsyncBatch:
353352
###########################################################################
354353

355354
async def get_connection(self) -> Connection:
356-
connection = await aiosqlite.connect(**self.connection_kwargs)
355+
connection = await connect(**self.connection_kwargs)
357356
connection.row_factory = dict_factory # type: ignore
358357
await connection.execute("PRAGMA foreign_keys = 1")
359358
return connection
@@ -363,7 +362,7 @@ async def get_connection(self) -> Connection:
363362
async def _run_in_new_connection(
364363
self, query: str, args: t.List[t.Any] = [], query_type: str = "generic"
365364
):
366-
async with aiosqlite.connect(**self.connection_kwargs) as connection:
365+
async with connect(**self.connection_kwargs) as connection:
367366
await connection.execute("PRAGMA foreign_keys = 1")
368367

369368
connection.row_factory = dict_factory # type: ignore

0 commit comments

Comments
 (0)