Skip to content

Commit 58fd993

Browse files
authored
Fix RowMapping.__getitem__ to reflect that it supports Columns or strings (#251)
1 parent e0b9f5d commit 58fd993

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sqlalchemy-stubs/engine/row.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ from typing import Sequence
1010
from typing import Tuple
1111
from typing import Type
1212
from typing import TypeVar
13+
from typing import Union
1314
from typing import ValuesView
1415

1516
from .result import ResultMetaData
1617
from .result import RMKeyView
18+
from ..sql.schema import Column
1719

1820
_T = TypeVar("_T")
1921

@@ -80,8 +82,8 @@ class ROMappingView( # type: ignore[misc]
8082
def __eq__(self, other: Any) -> bool: ...
8183
def __ne__(self, other: Any) -> bool: ...
8284

83-
class RowMapping(BaseRow, Mapping[str, Any]):
84-
def __getitem__(self, key: str) -> Any: ...
85+
class RowMapping(BaseRow, Mapping[Union[str, Column[Any]], Any]):
86+
def __getitem__(self, key: Union[str, Column[Any]]) -> Any: ...
8587
def __iter__(self) -> Iterator[str]: ...
8688
def __len__(self) -> int: ...
8789
def __contains__(self, key: Any) -> bool: ...

0 commit comments

Comments
 (0)