From e0b40f88446b86a46e6c066b0cb85510c38c4d1b Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 12 Feb 2010 20:42:19 +0000 Subject: [PATCH] adding more mapper sections nobody will ever see ! --- doc/build/examples.rst | 4 ++++ doc/build/mappers.rst | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/build/examples.rst b/doc/build/examples.rst index f91b8a69aa..ae84b68069 100644 --- a/doc/build/examples.rst +++ b/doc/build/examples.rst @@ -7,6 +7,8 @@ The SQLAlchemy distribution includes a variety of code examples illustrating a s Additional SQLAlchemy examples, some user contributed, are available on the wiki at ``_. +.. _examples_adjacencylist: + Adjacency List -------------- @@ -113,6 +115,8 @@ Location: /examples/vertical .. automodule:: vertical +.. _examples_xmlpersistence: + XML Persistence --------------- diff --git a/doc/build/mappers.rst b/doc/build/mappers.rst index 18ae039d9c..bafefa3758 100644 --- a/doc/build/mappers.rst +++ b/doc/build/mappers.rst @@ -825,6 +825,13 @@ example: The "non primary mapper" is a rarely needed feature of SQLAlchemy; in most cases, the ``Query`` object can produce any kind of query that's desired. It's recommended that a straight ``Query`` be used in place of a non-primary mapper unless the mapper approach is absolutely needed. Current use cases for the "non primary mapper" are when you want to map the class to a particular select statement or view to which additional query criterion can be added, and for when the particular mapped select statement or view is to be placed in a ``relation()`` of a parent mapper. +Multiple "Persistence" Mappers for One Class +--------------------------------------------- + +The non_primary mapper defines alternate mappers for the purposes of loading objects. What if we want the same class to be *persisted* differently, such as to different tables ? SQLAlchemy +refers to this as the "entity name" pattern, and in Python one can use a recipe which creates +anonymous subclasses which are distinctly mapped. See the recipe at `Entity Name `_. + Constructors and Object Initialization --------------------------------------- @@ -1136,7 +1143,7 @@ And the bi-directional version combines both: 'children': relation(Node, backref=backref('parent', remote_side=[nodes.c.id])) }) -There are several examples included with SQLAlchemy illustrating self-referential strategies; these include `basic_tree.py `_ and `optimized_al.py `_, the latter of which illustrates how to persist and search XML documents in conjunction with `ElementTree `_. +There are several examples included with SQLAlchemy illustrating self-referential strategies; these include :ref:`examples_adjacencylist` and :ref:`examples_xmlpersistence`. Self-Referential Query Strategies ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- 2.47.3