From ba9c86f2075bd4eb1d71caca58b6da6fe19e35ac Mon Sep 17 00:00:00 2001 From: Jens Troeger Date: Mon, 11 Mar 2024 17:11:45 -0400 Subject: [PATCH] add a docs cross-reference between adding columns & relationships to existing table mappings For context see discussion https://github.com/sqlalchemy/sqlalchemy/discussions/11124. This change adds the requested cross-reference to the documentation. This pull request is: - [X] A documentation / typographical / small typing error fix - Good to go, no issue or tests are needed - [ ] A short code fix - please include the issue number, and create an issue if none exists, which must include a complete example of the issue. one line code fixes without an issue and demonstration will not be accepted. - Please include: `Fixes: #` in the commit message - please include tests. one line code fixes without tests will not be accepted. - [ ] A new feature implementation - please include the issue number, and create an issue if none exists, which must include a complete example of how the feature would look. - Please include: `Fixes: #` in the commit message - please include tests. **Have a nice day!** Closes: #11133 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/11133 Pull-request-sha: f8cc7a9c510f058f75bcb4308f3f398b8ae70de8 Change-Id: Ic683354fa05560d869d47ceda820d88e758e2973 --- doc/build/orm/basic_relationships.rst | 4 +++- doc/build/orm/declarative_tables.rst | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/build/orm/basic_relationships.rst b/doc/build/orm/basic_relationships.rst index 0860f69fcf..a1bdb0525c 100644 --- a/doc/build/orm/basic_relationships.rst +++ b/doc/build/orm/basic_relationships.rst @@ -1102,8 +1102,10 @@ that will be passed to ``eval()`` are: are **evaluated as Python code expressions using eval(). DO NOT PASS UNTRUSTED INPUT TO THESE ARGUMENTS.** +.. _orm_declarative_table_adding_relationship: + Adding Relationships to Mapped Classes After Declaration -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ It should also be noted that in a similar way as described at :ref:`orm_declarative_table_adding_columns`, any :class:`_orm.MapperProperty` diff --git a/doc/build/orm/declarative_tables.rst b/doc/build/orm/declarative_tables.rst index 4a1cbd0da3..d2ed13841f 100644 --- a/doc/build/orm/declarative_tables.rst +++ b/doc/build/orm/declarative_tables.rst @@ -1158,6 +1158,10 @@ additional columns are present on mapped subclasses that have no :class:`.Table` of their own. This is illustrated in the section :ref:`single_inheritance`. +.. seealso:: + + :ref:`orm_declarative_table_adding_relationship` - similar examples for :func:`_orm.relationship` + .. note:: Assignment of mapped properties to an already mapped class will only function correctly if the "declarative base" class is used, meaning -- 2.47.2