summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/schema.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/sql/schema.py')
-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 34bedbc6a..127b12e81 100644
--- a/lib/sqlalchemy/sql/schema.py
+++ b/lib/sqlalchemy/sql/schema.py
@@ -1777,6 +1777,8 @@ class Column(DialectKWArgs, SchemaItem, ColumnClause):
table._columns.replace(self)
+ self.table = table
+
if self.primary_key:
table.primary_key._replace(self)
elif self.key in table.primary_key:
@@ -1786,8 +1788,6 @@ class Column(DialectKWArgs, SchemaItem, ColumnClause):
% (self.key, table.fullname)
)
- self.table = table
-
if self.index:
if isinstance(self.index, util.string_types):
raise exc.ArgumentError(
@@ -3838,7 +3838,6 @@ class PrimaryKeyConstraint(ColumnCollectionConstraint):
are already present.
"""
-
# set the primary key flag on new columns.
# note any existing PK cols on the table also have their
# flag still set.
@@ -3854,6 +3853,8 @@ class PrimaryKeyConstraint(ColumnCollectionConstraint):
PrimaryKeyConstraint._autoincrement_column._reset(self)
self.columns.replace(col)
+ self.dispatch._sa_event_column_added_to_pk_constraint(self, col)
+
@property
def columns_autoinc_first(self):
autoinc = self._autoincrement_column