MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / map

Method map

lib/sqlalchemy/orm/decl_base.py:2006–2021  ·  view source on GitHub ↗
(self, mapper_kw: _MapperKwArgs = util.EMPTY_DICT)

Source from the content-addressed store, hash-verified

2004 self.mapper_args = result_mapper_args
2005
2006 def map(self, mapper_kw: _MapperKwArgs = util.EMPTY_DICT) -> Mapper[Any]:
2007 self._prepare_mapper_arguments(mapper_kw)
2008 if hasattr(self.cls, "__mapper_cls__"):
2009 mapper_cls = cast(
2010 "Type[Mapper[Any]]",
2011 util.unbound_method_to_callable(
2012 self.cls.__mapper_cls__ # type: ignore
2013 ),
2014 )
2015 else:
2016 mapper_cls = Mapper
2017
2018 return self.set_cls_attribute(
2019 "__mapper__",
2020 mapper_cls(self.cls, self.local_table, **self.mapper_args),
2021 )
2022
2023
2024class _UnmappedDataclassConfig(_ClassScanAbstractConfig):

Callers

nothing calls this directly

Calls 3

set_cls_attributeMethod · 0.80
castFunction · 0.50

Tested by

no test coverage detected