]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- fix some docstring stuff
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 5 Jan 2014 21:42:56 +0000 (16:42 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 5 Jan 2014 21:42:56 +0000 (16:42 -0500)
doc/build/orm/internals.rst
lib/sqlalchemy/orm/base.py
lib/sqlalchemy/sql/schema.py
lib/sqlalchemy/sql/selectable.py

index 023a9f37b1da3b6221a8e9f82354761cad0a6b28..250bc777dfdc9274e588e8ff2dbf1cd8e9f7ac24 100644 (file)
@@ -10,64 +10,70 @@ sections, are listed here.
 
 .. autoclass:: sqlalchemy.orm.state.AttributeState
     :members:
-     
+
     :inherited-members:
 
 .. autoclass:: sqlalchemy.orm.instrumentation.ClassManager
     :members:
-     
+
     :inherited-members:
 
 .. autoclass:: sqlalchemy.orm.properties.ColumnProperty
     :members:
-     
+
     :inherited-members:
 
 .. autoclass:: sqlalchemy.orm.descriptor_props.CompositeProperty
     :members:
-     
+
 
 .. autoclass:: sqlalchemy.orm.attributes.Event
     :members:
-     
+
 
 .. autoclass:: sqlalchemy.orm.interfaces._InspectionAttr
     :members:
-     
+
 
 .. autoclass:: sqlalchemy.orm.state.InstanceState
     :members:
-     
+
 
 .. autoclass:: sqlalchemy.orm.attributes.InstrumentedAttribute
     :members: __get__, __set__, __delete__
-     
+
     :undoc-members:
 
+.. autodata:: sqlalchemy.orm.interfaces.MANYTOONE
+
+.. autodata:: sqlalchemy.orm.interfaces.MANYTOMANY
+
 .. autoclass:: sqlalchemy.orm.interfaces.MapperProperty
     :members:
-     
 
 .. autodata:: sqlalchemy.orm.interfaces.NOT_EXTENSION
 
+
+.. autodata:: sqlalchemy.orm.interfaces.ONETOMANY
+
 .. autoclass:: sqlalchemy.orm.interfaces.PropComparator
     :members:
-     
+
     :inherited-members:
 
 .. autoclass:: sqlalchemy.orm.properties.RelationshipProperty
     :members:
-     
+
     :inherited-members:
 
 .. autoclass:: sqlalchemy.orm.descriptor_props.SynonymProperty
     :members:
-     
+
     :inherited-members:
 
 .. autoclass:: sqlalchemy.orm.query.QueryContext
     :members:
-     
+
 
 .. autoclass:: sqlalchemy.orm.attributes.QueryableAttribute
     :members:
index 22c92b7c1f65bfc091c75b6beada2447608e02ed..d59fac0f2e08dad88acbe870c789ec3f3691a4eb 100644 (file)
@@ -114,18 +114,38 @@ _INSTRUMENTOR = ('mapper', 'instrumentor')
 EXT_CONTINUE = util.symbol('EXT_CONTINUE')
 EXT_STOP = util.symbol('EXT_STOP')
 
-ONETOMANY = util.symbol('ONETOMANY')
-MANYTOONE = util.symbol('MANYTOONE')
-MANYTOMANY = util.symbol('MANYTOMANY')
+ONETOMANY = util.symbol('ONETOMANY',
+"""Indicates the one-to-many direction for a :func:`.relationship`.
 
-NOT_EXTENSION = util.symbol('NOT_EXTENSION')
+This symbol is typically used by the internals but may be exposed within
+certain API features.
+
+""")
+
+MANYTOONE = util.symbol('MANYTOONE',
+"""Indicates the many-to-one direction for a :func:`.relationship`.
+
+This symbol is typically used by the internals but may be exposed within
+certain API features.
+
+""")
+
+MANYTOMANY = util.symbol('MANYTOMANY',
+"""Indicates the many-to-many direction for a :func:`.relationship`.
+
+This symbol is typically used by the internals but may be exposed within
+certain API features.
+
+""")
+
+NOT_EXTENSION = util.symbol('NOT_EXTENSION',
 """Symbol indicating an :class:`_InspectionAttr` that's
    not part of sqlalchemy.ext.
 
    Is assigned to the :attr:`._InspectionAttr.extension_type`
    attibute.
 
-"""
+""")
 
 _none_set = frozenset([None])
 
index 97c160bf5b15519a2eb8f60ad94767ef45b42d39..f8aaac12f7736e3973d0946d9d0dd17b5aff77e6 100644 (file)
@@ -522,6 +522,14 @@ class Table(SchemaItem, TableClause):
 
     @property
     def key(self):
+        """Return the 'key' for this :class:`.Table`.
+
+        This value is used as the dictionary key within the
+        :attr:`.MetaData.tables` collection.   It is typically the same
+        as that of :attr:`.Table.name` for a table with no :attr:`.Table.schema`
+        set; otherwise it is typically of the form ``schemaname.tablename``.
+
+        """
         return _get_table_key(self.name, self.schema)
 
     def __repr__(self):
@@ -2719,20 +2727,11 @@ class MetaData(SchemaItem):
     execution.
 
     The :class:`.Table` objects themselves are stored in the
-    ``metadata.tables`` dictionary.
-
-    The ``bind`` property may be assigned to dynamically.  A common pattern is
-    to start unbound and then bind later when an engine is available::
+    :attr:`.MetaData.tables` dictionary.
 
-      metadata = MetaData()
-      # define tables
-      Table('mytable', metadata, ...)
-      # connect to an engine later, perhaps after loading a URL from a
-      # configuration file
-      metadata.bind = an_engine
-
-    MetaData is a thread-safe object after tables have been explicitly defined
-    or loaded via reflection.
+    :class:`.MetaData` is a thread-safe object for read operations.  Construction
+    of new tables within a single :class:`.MetaData` object, either explicitly
+    or via reflection, may not be completely thread-safe.
 
     .. seealso::
 
@@ -2788,6 +2787,20 @@ class MetaData(SchemaItem):
                     "with reflect=True")
             self.reflect()
 
+    tables = None
+    """A dictionary of :class:`.Table` objects keyed to their name or "table key".
+
+    The exact key is that determined by the :attr:`.Table.key` attribute;
+    for a table with no :attr:`.Table.schema` attribute, this is the same
+    as :attr:`.Table.name`.  For a table with a schema, it is typically of the
+    form ``schemaname.tablename``.
+
+    .. seealso::
+
+        :attr:`.MetaData.sorted_tables`
+
+    """
+
     def __repr__(self):
         return 'MetaData(bind=%r)' % self.bind
 
@@ -2889,7 +2902,9 @@ class MetaData(SchemaItem):
 
         .. seealso::
 
-            :meth:`.Inspector.sorted_tables`
+            :attr:`.MetaData.tables`
+
+            :meth:`.Inspector.get_table_names`
 
         """
         return ddl.sort_tables(self.tables.values())
index ab8b6667c52f039b78997a9bfb2f7db91f525061..887805aadd4c8bada2111f1b29b9b048a038475a 100644 (file)
@@ -136,7 +136,15 @@ class FromClause(Selectable):
     __visit_name__ = 'fromclause'
     named_with_column = False
     _hide_froms = []
+
     schema = None
+    """Define the 'schema' attribute for this :class:`.FromClause`.
+
+    This is typically ``None`` for most objects except that of :class:`.Table`,
+    where it is taken as the value of the :paramref:`.Table.schema` argument.
+
+    """
+
     _memoized_property = util.group_expirable_memoized_property(["_columns"])
 
     @util.dependencies("sqlalchemy.sql.functions")