Commits

Mike Bayer committed fe3ac99

defaults and constraints have optional parent

Comments (0)

Files changed (1)

lib/sqlalchemy/schema.py

         except AttributeError:
             return self._metadata
     def _get_parent(self):
-        return self.column
+        return getattr(self, 'column', None)
     def _set_parent(self, column):
         self.column = column
         self._metadata = self.column.table.metadata
     def copy(self):
         raise NotImplementedError()
     def _get_parent(self):
-        return self.table
+        return getattr(self, 'table', None)
         
 class ForeignKeyConstraint(Constraint):
     """table-level foreign key constraint, represents a colleciton of ForeignKey objects."""