# sqlalchemy 2.1.9 (MIT), harvested by tools/harvest_corpus.py
=== input
Sort a collection of :class:`_schema.Table` objects based on
    dependency.

    This is a dependency-ordered sort which will emit :class:`_schema.Table`
    objects such that they will follow their dependent :class:`_schema.Table`
    objects.
    Tables are dependent on another based on the presence of
    :class:`_schema.ForeignKeyConstraint`
    objects as well as explicit dependencies
    added by :meth:`_schema.Table.add_is_dependent_on`.

    .. warning::

        The :func:`._schema.sort_tables` function cannot by itself
        accommodate automatic resolution of dependency cycles between
        tables, which are usually caused by mutually dependent foreign key
        constraints. When these cycles are detected, the foreign keys
        of these tables are omitted from consideration in the sort.
        A warning is emitted when this condition occurs, which will be an
        exception raise in a future release.   Tables which are not part
        of the cycle will still be returned in dependency order.

        To resolve these cycles, the
        :paramref:`_schema.ForeignKeyConstraint.use_alter` parameter may be
        applied to those constraints which create a cycle.  Alternatively,
        the :func:`_schema.sort_tables_and_constraints` function will
        automatically return foreign key constraints in a separate
        collection when cycles are detected so that they may be applied
        to a schema separately.

    :param tables: a sequence of :class:`_schema.Table` objects.

    :param skip_fn: optional callable which will be passed a
     :class:`_schema.ForeignKeyConstraint` object; if it returns True, this
     constraint will not be considered as a dependency.  Note this is
     **different** from the same parameter in
     :func:`.sort_tables_and_constraints`, which is
     instead passed the owning :class:`_schema.ForeignKeyConstraint` object.

    :param extra_dependencies: a sequence of 2-tuples of tables which will
     also be considered as dependent on each other.

    .. seealso::

        :func:`.sort_tables_and_constraints`

        :attr:`_schema.MetaData.sorted_tables` - uses this function to sort


    
=== parse rest
short_description: |
  Sort a collection of :class:`_schema.Table` objects based on
  dependency.
long_description: |
  This is a dependency-ordered sort which will emit :class:`_schema.Table`
  objects such that they will follow their dependent :class:`_schema.Table`
  objects.
  Tables are dependent on another based on the presence of
  :class:`_schema.ForeignKeyConstraint`
  objects as well as explicit dependencies
  added by :meth:`_schema.Table.add_is_dependent_on`.
  
  .. warning::
  
      The :func:`._schema.sort_tables` function cannot by itself
      accommodate automatic resolution of dependency cycles between
      tables, which are usually caused by mutually dependent foreign key
      constraints. When these cycles are detected, the foreign keys
      of these tables are omitted from consideration in the sort.
      A warning is emitted when this condition occurs, which will be an
      exception raise in a future release.   Tables which are not part
      of the cycle will still be returned in dependency order.
  
      To resolve these cycles, the
      :paramref:`_schema.ForeignKeyConstraint.use_alter` parameter may be
      applied to those constraints which create a cycle.  Alternatively,
      the :func:`_schema.sort_tables_and_constraints` function will
      automatically return foreign key constraints in a separate
      collection when cycles are detected so that they may be applied
      to a schema separately.
  
  .. seealso::
  
      :func:`.sort_tables_and_constraints`
  
      :attr:`_schema.MetaData.sorted_tables` - uses this function to sort
blank_after_short_description: True
blank_after_long_description: True
style: rest
- DocstringParam
  description: 'a sequence of :class:`_schema.Table` objects.'
  kind: param
  key: 'param'
  arg_name: 'tables'
  is_optional: False
- DocstringParam
  description: |
    optional callable which will be passed a
    :class:`_schema.ForeignKeyConstraint` object; if it returns True, this
    constraint will not be considered as a dependency.  Note this is
    **different** from the same parameter in
    :func:`.sort_tables_and_constraints`, which is
    instead passed the owning :class:`_schema.ForeignKeyConstraint` object.
  kind: param
  key: 'param'
  arg_name: 'skip_fn'
  is_optional: False
- DocstringParam
  description: |
    a sequence of 2-tuples of tables which will
    also be considered as dependent on each other.
  kind: param
  key: 'param'
  arg_name: 'extra_dependencies'
  is_optional: False
=== detect
rest
=== compose rest
Sort a collection of :class:`_schema.Table` objects based on
dependency.

This is a dependency-ordered sort which will emit :class:`_schema.Table`
objects such that they will follow their dependent :class:`_schema.Table`
objects.
Tables are dependent on another based on the presence of
:class:`_schema.ForeignKeyConstraint`
objects as well as explicit dependencies
added by :meth:`_schema.Table.add_is_dependent_on`.

.. warning::

    The :func:`._schema.sort_tables` function cannot by itself
    accommodate automatic resolution of dependency cycles between
    tables, which are usually caused by mutually dependent foreign key
    constraints. When these cycles are detected, the foreign keys
    of these tables are omitted from consideration in the sort.
    A warning is emitted when this condition occurs, which will be an
    exception raise in a future release.   Tables which are not part
    of the cycle will still be returned in dependency order.

    To resolve these cycles, the
    :paramref:`_schema.ForeignKeyConstraint.use_alter` parameter may be
    applied to those constraints which create a cycle.  Alternatively,
    the :func:`_schema.sort_tables_and_constraints` function will
    automatically return foreign key constraints in a separate
    collection when cycles are detected so that they may be applied
    to a schema separately.

.. seealso::

    :func:`.sort_tables_and_constraints`

    :attr:`_schema.MetaData.sorted_tables` - uses this function to sort

:param tables: a sequence of :class:`_schema.Table` objects.
:param skip_fn: optional callable which will be passed a
    :class:`_schema.ForeignKeyConstraint` object; if it returns True, this
    constraint will not be considered as a dependency.  Note this is
    **different** from the same parameter in
    :func:`.sort_tables_and_constraints`, which is
    instead passed the owning :class:`_schema.ForeignKeyConstraint` object.
:param extra_dependencies: a sequence of 2-tuples of tables which will
    also be considered as dependent on each other.
