Skip to content

Commit fbcce8e

Browse files
authored
[sqlite3] Support Row type in row_factory and type connection attribute as well (#15073)
1 parent c42613e commit fbcce8e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

stdlib/sqlite3/__init__.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ _AdaptedInputData: TypeAlias = _SqliteData | Any
222222
_Parameters: TypeAlias = SupportsLenAndGetItem[_AdaptedInputData] | Mapping[str, _AdaptedInputData]
223223
# Controls the legacy transaction handling mode of sqlite3.
224224
_IsolationLevel: TypeAlias = Literal["DEFERRED", "EXCLUSIVE", "IMMEDIATE"] | None
225+
_RowFactoryOptions: TypeAlias = type[Row] | Callable[[Cursor, Row], object] | None
225226

226227
@type_check_only
227228
class _AnyParamWindowAggregateClass(Protocol):
@@ -300,7 +301,7 @@ class Connection:
300301
def autocommit(self) -> int: ...
301302
@autocommit.setter
302303
def autocommit(self, val: int) -> None: ...
303-
row_factory: Any
304+
row_factory: _RowFactoryOptions
304305
text_factory: Any
305306
if sys.version_info >= (3, 12):
306307
def __init__(
@@ -416,7 +417,7 @@ class Cursor:
416417
def description(self) -> tuple[tuple[str, None, None, None, None, None, None], ...] | MaybeNone: ...
417418
@property
418419
def lastrowid(self) -> int | None: ...
419-
row_factory: Callable[[Cursor, Row], object] | None
420+
row_factory: _RowFactoryOptions
420421
@property
421422
def rowcount(self) -> int: ...
422423
def __init__(self, cursor: Connection, /) -> None: ...

0 commit comments

Comments
 (0)