Ahah excellent, thanks! Googling "sqlalchemy history table" / "sqlalchemy audit table" and searching the docs but those matches don't show up :P
Glad to have one way of doing it ... I don't think this uses triggers and I wonder if this can be optimized much by making use of triggers. If I happen to explore and implement that route I'll post the approach here for future searchers. Any pointers on a trigger implementation from anyone also appreciated. Cheers On Monday, November 19, 2012 12:13:29 PM UTC-8, Robert Forkel wrote: > > http://docs.sqlalchemy.org/en/rel_0_8/orm/examples.html#versioned-objects > looks like what you may want. > > On Mon, Nov 19, 2012 at 9:10 PM, LPG <lenn...@gmail.com <javascript:>> > wrote: > > I'm looking for details on implementing an audit table, either through > sqla > > itself or in a way that plays nicely with sqla. It looks like there used > to > > be an implementation of something like that at > > http://www.sqlalchemy.org/trac/wiki/UsageRecipes/LogVersions, does > anyone > > know where that code lives now? > > > > I figure there is probably a way to define the history table entirely in > > sqla, or perhaps preferably with db triggers. I'm using PostgreSQL / the > > trigger option is certainly available. If I go the trigger route ... is > > there a way to still have access to the history table object through > sqla? I > > suppose I create a mapping to that table? > > > > To illustrate the scenario, say I have a bank_account table: > > > > bank_account > > - id > > - balance > > > > And a history table for it: > > > > bank_account_history > > - bid > > - timestamp > > - balance > > > > Should the history table implementation be done in sqla or should it be > a db > > trigger with a sqla mapping? Either way I want to read from the history > > table with SQLA. Any pointers appreciated! > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "sqlalchemy" group. > > To view this discussion on the web visit > > https://groups.google.com/d/msg/sqlalchemy/-/Ru8xYbuARNsJ. > > To post to this group, send email to > > sqlal...@googlegroups.com<javascript:>. > > > To unsubscribe from this group, send email to > > sqlalchemy+...@googlegroups.com <javascript:>. > > For more options, visit this group at > > http://groups.google.com/group/sqlalchemy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/JV3JFHGOEpMJ. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.