Thanks, Mike! That let me slap together a quick mixin class to store versioned data (of specific columns) in PostgreSQL -
class RevisionObject(object): > revision_columns = None > revision_id = sa.Column(sa.Integer, nullable=False, default=0 ) > revision_history = sa.Column( sqlalchemy.dialects.postgresql.HSTORE , > nullable=True ) > def > generate_snapshot(self,only_fields=None,timestamp=None,editor=None): > rval = { > 'data': {} , > 'meta': { > 'timestamp_edit' : timestamp , > 'useraccount_id__editor' : editor , > } > } > for c in self.revision_columns : > rval['data'][c] = getattr(self,c) > return rval > > def generate_diff(self,timestamp=None,editor=None): > insp = inspect(self) > rval = { > 'data': {} , > 'meta': { > 'timestamp_edit' : timestamp , > 'useraccount_id__editor' : editor , > } > } > for c in self.revision_columns : > h = getattr( insp.attrs , c).history > if h[1]: > continue > rval['data'][c] = h[0] > if rval['data'] : > return rval > return {} -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.