Greeting Alchemists, in order to implement schema diffing, it would be nice if two similar ColumnDefault objects would be comparable as such. I attach a path to implement such test. Would it make sense to add this support in Alchemy's core or should a schema diffing library add it through monkey patching?
-- Yannick Gingras --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
Index: lib/sqlalchemy/schema.py =================================================================== --- lib/sqlalchemy/schema.py (revision 4842) +++ lib/sqlalchemy/schema.py (working copy) @@ -970,2 +970,2 @@ return "column_default" __visit_name__ = property(_visit_name) + def __eq__(self, other): + if self.__class__ != other.__class__: + return NotImplemented + if callable(self.arg) and callable(other.arg): + return NotImplemented + return self.arg == other.arg + + def __ne__(self, other): + return not self.__eq__(other) + def __repr__(self): return "ColumnDefault(%s)" % repr(self.arg) + class Sequence(DefaultGenerator): """Represents a named database sequence."""