]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Fix example with deprecated code 6875/head
authorJoão Sampaio <jpmelos@gmail.com>
Wed, 11 Aug 2021 14:36:49 +0000 (11:36 -0300)
committerGitHub <noreply@github.com>
Wed, 11 Aug 2021 14:36:49 +0000 (11:36 -0300)
Just a few lines above, it is said that creating a mapping with `mapper()` is deprecated in favor of `mapper_registry.map_imperatively()`. This PR fixes an example in the documentation that still uses the old function.

doc/build/orm/mapping_styles.rst

index 09f01102bf7920a78562703f8f97f904dc765515..0f5d4f4719445ac4c44a68b30485ad5a7a9e06f6 100644 (file)
@@ -571,11 +571,11 @@ object, mapped to a class called ``Address``, then linked to ``User`` via :func:
                 Column('email_address', String(50))
                 )
 
-    mapper(User, user, properties={
+    mapper_registry.map_imperatively(User, user, properties={
         'addresses' : relationship(Address, backref='user', order_by=address.c.id)
     })
 
-    mapper(Address, address)
+    mapper_registry.map_imperatively(Address, address)
 
 When using classical mappings, classes must be provided directly without the benefit
 of the "string lookup" system provided by Declarative.  SQL expressions are typically