From: Mike Bayer Date: Wed, 25 Apr 2007 17:22:16 +0000 (+0000) Subject: #553 propigate index on copied columns X-Git-Tag: rel_0_3_7~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=41ff863fc0669dda66f9afe6890e16172252f8b5;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git #553 propigate index on copied columns --- diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py index a0dd287e33..a27adf06ee 100644 --- a/lib/sqlalchemy/schema.py +++ b/lib/sqlalchemy/schema.py @@ -571,11 +571,11 @@ class Column(SchemaItem, sql._ColumnClause): if self.index: if isinstance(self.index, basestring): - raise exceptions.ArgumentError("The 'index' keyword argument on Column is boolean only. To create indexes with a specific name, append an explicit Index object to the Table's list of elements.") + raise exceptions.ArgumentError("The 'index' keyword argument on Column is boolean only. To create indexes with a specific name, create an explicit Index object external to the Table.") Index('ix_%s' % self._label, self, unique=self.unique) elif self.unique: if isinstance(self.unique, basestring): - raise exceptions.ArgumentError("The 'unique' keyword argument on Column is boolean only. To create unique constraints or indexes with a specific name, append an explicit UniqueConstraint or Index object to the Table's list of elements.") + raise exceptions.ArgumentError("The 'unique' keyword argument on Column is boolean only. To create unique constraints or indexes with a specific name, append an explicit UniqueConstraint to the Table's list of elements, or create an explicit Index object external to the Table.") table.append_constraint(UniqueConstraint(self.key)) toinit = list(self.args) @@ -592,7 +592,7 @@ class Column(SchemaItem, sql._ColumnClause): This is used in ``Table.tometadata``. """ - return Column(self.name, self.type, self.default, key = self.key, primary_key = self.primary_key, nullable = self.nullable, _is_oid = self._is_oid, case_sensitive=self._case_sensitive_setting, quote=self.quote, *[c.copy() for c in self.constraints]) + return Column(self.name, self.type, self.default, key = self.key, primary_key = self.primary_key, nullable = self.nullable, _is_oid = self._is_oid, case_sensitive=self._case_sensitive_setting, quote=self.quote, index=self.index, *[c.copy() for c in self.constraints]) def _make_proxy(self, selectable, name = None): """Create a *proxy* for this column.