summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-10-11 15:55:57 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-10-11 15:55:57 -0400
commit9d38ed33400adf3ba8fdf3af49f26de1270bbe23 (patch)
treebe88cbfb8654fc5cb119e05a0829c2111b966de2 /lib/sqlalchemy
parent5f0b864ad02409cf668fa7db5cbac99ac6ffc329 (diff)
downloadsqlalchemy-9d38ed33400adf3ba8fdf3af49f26de1270bbe23.tar.gz
The "name" attribute is set on :class:`.Index` before the "attach"
events are called, so that attachment events can be used to dynamically generate a name for the index based on the parent table and/or columns. [ticket:2835]
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/sql/schema.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py
index 92220b0d1..c493b9132 100644
--- a/lib/sqlalchemy/sql/schema.py
+++ b/lib/sqlalchemy/sql/schema.py
@@ -2600,14 +2600,15 @@ class Index(ColumnCollectionMixin, SchemaItem):
columns.append(expr)
self.expressions = expressions
+ self.name = quoted_name(name, kw.pop("quote", None))
+ self.unique = kw.pop('unique', False)
+ self.kwargs = kw
# will call _set_parent() if table-bound column
# objects are present
ColumnCollectionMixin.__init__(self, *columns)
- self.name = quoted_name(name, kw.pop("quote", None))
- self.unique = kw.pop('unique', False)
- self.kwargs = kw
+
def _set_parent(self, table):
ColumnCollectionMixin._set_parent(self, table)