__slots__ = ()
_items: Sequence[Any]
- _mapping: Mapping[str, Any]
+ _mapping: Mapping["_KeyType", Any]
- def __init__(self, mapping: Mapping[str, Any], items: Sequence[Any]):
+ def __init__(
+ self, mapping: Mapping["_KeyType", Any], items: Sequence[Any]
+ ):
self._mapping = mapping
self._items = items
class ROMappingKeysValuesView(
- ROMappingView, typing.KeysView[str], typing.ValuesView[Any]
+ ROMappingView, typing.KeysView["_KeyType"], typing.ValuesView[Any]
):
__slots__ = ("_items",)
-class ROMappingItemsView(ROMappingView, typing.ItemsView[str, Any]):
+class ROMappingItemsView(ROMappingView, typing.ItemsView["_KeyType", Any]):
__slots__ = ("_items",)
-class RowMapping(BaseRow, typing.Mapping[str, Any]):
+class RowMapping(BaseRow, typing.Mapping["_KeyType", Any]):
"""A ``Mapping`` that maps column names and objects to :class:`.Row`
values.
r = connection.exec_driver_sql("select user_name from users").first()
eq_(len(r), 1)
+ def test_row_mapping_get(self, connection):
+ users = self.tables.users
+
+ connection.execute(users.insert(), dict(user_id=1, user_name="foo"))
+ result = connection.execute(users.select())
+ row = result.first()
+ eq_(row._mapping.get("user_id"), 1)
+ eq_(row._mapping.get(users.c.user_id), 1)
+
def test_sorting_in_python(self, connection):
users = self.tables.users