From: Mike Bayer Date: Fri, 13 Mar 2015 20:22:01 +0000 (-0400) Subject: - tweaks regarding the use_alter update X-Git-Tag: rel_1_0_0b1~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4077e99f3f51789474bfe4f7ebee666682bf5cdd;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - tweaks regarding the use_alter update --- diff --git a/doc/build/orm/relationship_persistence.rst b/doc/build/orm/relationship_persistence.rst index 6d2ba78823..8af96cbd6d 100644 --- a/doc/build/orm/relationship_persistence.rst +++ b/doc/build/orm/relationship_persistence.rst @@ -56,8 +56,7 @@ have been INSERTED; it also causes the rows to be de-associated with each other via UPDATE before a DELETE is emitted. The flag should be placed on just *one* of the relationships, preferably the many-to-one side. Below we illustrate -a complete example, including two :class:`.ForeignKey` constructs, one which -specifies :paramref:`~.ForeignKey.use_alter` to help with emitting CREATE TABLE statements:: +a complete example, including two :class:`.ForeignKey` constructs:: from sqlalchemy import Integer, ForeignKey, Column from sqlalchemy.ext.declarative import declarative_base @@ -77,7 +76,6 @@ specifies :paramref:`~.ForeignKey.use_alter` to help with emitting CREATE TABLE widget_id = Column(Integer, primary_key=True) favorite_entry_id = Column(Integer, ForeignKey('entry.entry_id', - use_alter=True, name="fk_favorite_entry")) name = Column(String(50)) @@ -145,7 +143,7 @@ as illustrated below:: ForeignKeyConstraint( ["widget_id", "favorite_entry_id"], ["entry.widget_id", "entry.entry_id"], - name="fk_favorite_entry", use_alter=True + name="fk_favorite_entry" ), ) diff --git a/lib/sqlalchemy/exc.py b/lib/sqlalchemy/exc.py index c0d51382dd..9b27436b30 100644 --- a/lib/sqlalchemy/exc.py +++ b/lib/sqlalchemy/exc.py @@ -54,8 +54,7 @@ class CircularDependencyError(SQLAlchemyError): or pre-deassociate one of the foreign key constrained values. 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` + * In a :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`.