diff options
Diffstat (limited to 'lib/sqlalchemy/exc.py')
-rw-r--r-- | lib/sqlalchemy/exc.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/sqlalchemy/exc.py b/lib/sqlalchemy/exc.py index 0cc52fd25..c76f68d21 100644 --- a/lib/sqlalchemy/exc.py +++ b/lib/sqlalchemy/exc.py @@ -27,9 +27,24 @@ class ArgumentError(SQLAlchemyError): class CircularDependencyError(SQLAlchemyError): - """Raised by topological sorts when a circular dependency is detected""" + """Raised by topological sorts when a circular dependency is detected. + + There are two scenarios where this error occurs: + + * In a Session flush operation, if two objects are mutually dependent + on each other, they can not be inserted or deleted via INSERT or + DELETE statements alone; an UPDATE will be needed to deassociate + one of the foreign key constraints first. The ``post_update`` flag + described at :ref:`post_update` can resolve this cycle. + * In a :meth:`.MetaData.create_all`, :meth:`.MetaData.drop_all`, + :attr:`.MetaData.sorted_tables` operation, two :class:`.ForeignKey` + or :class:`.ForeignKeyConstraint` objects mutually refer to each + other. Apply the ``use_alter=True`` flag to one or both, + see :ref:`use_alter`. + + """ def __init__(self, message, cycles, edges): - message += ": cycles: %r all edges: %r" % (cycles, edges) + message += " Cycles: %r all edges: %r" % (cycles, edges) SQLAlchemyError.__init__(self, message) self.cycles = cycles self.edges = edges |