From 4e61d03dd462877c9ead514cef957bc63a52702b Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 4 Jan 2022 15:38:15 -0500 Subject: [PATCH] update stale documentation on Mapper class don't get into details here that have changed, point to the main narrative documentation instead. Change-Id: I5bc0829f6ff282ca104f18deb9ec9857b6e1c8ac (cherry picked from commit 9298ce03e1181d5bc00c1891663433606ead1223) --- lib/sqlalchemy/orm/mapper.py | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py index 9ac18bea66..af63c52399 100644 --- a/lib/sqlalchemy/orm/mapper.py +++ b/lib/sqlalchemy/orm/mapper.py @@ -91,35 +91,14 @@ class Mapper( sql_base.MemoizedHasCacheKey, InspectionAttr, ): - """Define the correlation of class attributes to database table - columns. + """Defines an association between a Python class and a database table or + other relational structure, so that ORM operations against the class may + proceed. - The :class:`_orm.Mapper` object is instantiated using the - :func:`~sqlalchemy.orm.mapper` function. For information + The :class:`_orm.Mapper` object is instantiated using mapping methods + present on the :class:`_orm.registry` object. For information about instantiating new :class:`_orm.Mapper` objects, see - that function's documentation. - - - When :func:`.mapper` is used - explicitly to link a user defined class with table - metadata, this is referred to as *classical mapping*. - Modern SQLAlchemy usage tends to favor the - :mod:`sqlalchemy.ext.declarative` extension for class - configuration, which - makes usage of :func:`.mapper` behind the scenes. - - Given a particular class known to be mapped by the ORM, - the :class:`_orm.Mapper` which maintains it can be acquired - using the :func:`_sa.inspect` function:: - - from sqlalchemy import inspect - - mapper = inspect(MyClass) - - A class which was mapped by the :mod:`sqlalchemy.ext.declarative` - extension will also have its mapper available via the ``__mapper__`` - attribute. - + :ref:`orm_mapping_classes_toplevel`. """ -- 2.47.2