MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / map

Method map

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

Source from the content-addressed store, hash-verified

1993 self.mapper_args = result_mapper_args
1994
1995 def map(self, mapper_kw: _MapperKwArgs = util.EMPTY_DICT) -> Mapper[Any]:
1996 self._prepare_mapper_arguments(mapper_kw)
1997 if hasattr(self.cls, "__mapper_cls__"):
1998 mapper_cls = cast(
1999 "Type[Mapper[Any]]",
2000 util.unbound_method_to_callable(
2001 self.cls.__mapper_cls__ # type: ignore
2002 ),
2003 )
2004 else:
2005 mapper_cls = Mapper
2006
2007 return self.set_cls_attribute(
2008 "__mapper__",
2009 mapper_cls(self.cls, self.local_table, **self.mapper_args),
2010 )
2011
2012
2013@util.preload_module("sqlalchemy.orm.decl_api")

Callers

nothing calls this directly

Calls 3

castFunction · 0.85
set_cls_attributeMethod · 0.80

Tested by

no test coverage detected