]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
moved all fixed instances of set[] -> Set[]
authorHarry Lees <harry.lees@gmail.com>
Tue, 31 Jan 2023 13:07:56 +0000 (13:07 +0000)
committerHarry Lees <harry.lees@gmail.com>
Tue, 31 Jan 2023 13:07:56 +0000 (13:07 +0000)
doc/build/orm/basic_relationships.rst
doc/build/orm/collection_api.rst

index 116c6b6d4bb8793c760057b36b085f4cdda80141..eb4704f7e7b2a63066d3d2758a3fa05ae7da980d 100644 (file)
@@ -156,13 +156,13 @@ Using annotated Declarative mappings, the type of collection used for the
 :func:`_orm.relationship` is derived from the collection type passed to the
 :class:`_orm.Mapped` container type.  The example from the previous section
 may be written to use a ``set`` rather than a ``list`` for the
-``Parent.children`` collection using ``Mapped[set["Child"]]``::
+``Parent.children`` collection using ``Mapped[Set["Child"]]``::
 
     class Parent(Base):
         __tablename__ = "parent_table"
 
         id: Mapped[int] = mapped_column(primary_key=True)
-        children: Mapped[set["Child"]] = relationship(back_populates="parent")
+        children: Mapped[Set["Child"]] = relationship(back_populates="parent")
 
 When using non-annotated forms including imperative mappings, the Python
 class to use as a collection may be passed using the
@@ -523,7 +523,7 @@ such as ``set``::
         __tablename__ = "left_table"
 
         id: Mapped[int] = mapped_column(primary_key=True)
-        children: Mapped[set["Child"]] = relationship(secondary=association_table)
+        children: Mapped[Set["Child"]] = relationship(secondary=association_table)
 
 When using non-annotated forms including imperative mappings, as is
 the case with one-to-many, the Python
index f580b26c939d69d2692678dd2cdd12cc760e1eec..1f35c022672b5694109c7ef704997b26b5303e6f 100644 (file)
@@ -59,6 +59,7 @@ below where ``list`` is used::
 Or for a ``set``, illustrated in the same
 ``Parent.children`` collection::
 
+    from typing import Set
     from sqlalchemy import ForeignKey
 
     from sqlalchemy.orm import DeclarativeBase
@@ -77,7 +78,7 @@ Or for a ``set``, illustrated in the same
         parent_id: Mapped[int] = mapped_column(primary_key=True)
 
         # use a set
-        children: Mapped[set["Child"]] = relationship()
+        children: Mapped[Set["Child"]] = relationship()
 
 
     class Child(Base):