summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/schema.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-02-25 13:20:43 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2011-02-25 13:20:43 -0500
commita7f766d7c7fd6c53eb0019e32569e915b3f31eb4 (patch)
tree25f6234f67bbea40bb95eb34572bd2f67136e33f /lib/sqlalchemy/schema.py
parent34d6c9bc7dafbb2717ae10b6e11942e2dd409f35 (diff)
downloadsqlalchemy-a7f766d7c7fd6c53eb0019e32569e915b3f31eb4.tar.gz
- establish an "insert" option for events to control ordering if needed (not needed yet tho)
- render foreign key constraints in the order in which they were cerated
Diffstat (limited to 'lib/sqlalchemy/schema.py')
-rw-r--r--lib/sqlalchemy/schema.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py
index e6b970291..80d6018b8 100644
--- a/lib/sqlalchemy/schema.py
+++ b/lib/sqlalchemy/schema.py
@@ -265,6 +265,12 @@ class Table(SchemaItem, expression.TableClause):
# allow user-overrides
self._init_items(*args)
+ @property
+ def _sorted_constraints(self):
+ """Return the set of constraints as a list, sorted by creation order."""
+
+ return sorted(self.constraints, key=lambda c:c._creation_order)
+
def _init_existing(self, *args, **kwargs):
autoload = kwargs.pop('autoload', False)
autoload_with = kwargs.pop('autoload_with', None)
@@ -1595,6 +1601,7 @@ class Constraint(SchemaItem):
self.deferrable = deferrable
self.initially = initially
self._create_rule = _create_rule
+ util.set_creation_order(self)
@property
def table(self):