]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
added an assertion to insure that a column is only attached to one table
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 17 Feb 2006 18:29:26 +0000 (18:29 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 17 Feb 2006 18:29:26 +0000 (18:29 +0000)
lib/sqlalchemy/schema.py

index 8e85fb310b1c34d5bcb615ff486bbd0d38bcf327..bb926053d630edc772328036f202a5c36addab7c 100644 (file)
@@ -271,6 +271,8 @@ class Column(SchemaItem):
         self.table.primary_key.append(self)
             
     def _set_parent(self, table):
+        if getattr(self, 'table', None) is not None:
+            raise "this Column already has a table!"
         if not self.hidden:
             table.columns[self.key] = self
             if self.primary_key: