13 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: Separate version table
FromSent OnAttachments
mmstud28 Oct 2007 07:37 
Arnar Birgisson28 Oct 2007 09:00 
sdob...@sistechnology.com28 Oct 2007 12:04 
mmstud28 Oct 2007 13:42 
mmstud28 Oct 2007 13:45 
Arnar Birgisson28 Oct 2007 14:51 
mmstud29 Oct 2007 00:03 
sdob...@sistechnology.com29 Oct 2007 00:08 
mmstud29 Oct 2007 02:24 
mmstud29 Oct 2007 02:34 
Arnar Birgisson29 Oct 2007 02:35 
Arnar Birgisson29 Oct 2007 02:47 
mmstud30 Oct 2007 06:45 
Subject:[sqlalchemy] Re: Separate version table
From:mmstud (mms@gmail.com)
Date:10/29/2007 02:34:27 AM
List:com.googlegroups.sqlalchemy

On 29 loka, 09:08, sdob@sistechnology.com wrote:

I dont need history tracking, just revert documents to older ones.

that is history, just not timed history.

Most optimal would it be, if i can make rows with updated fields only, not to copy whole row... but im afraid setting unchanged field to None would be problematic when retrieving versions. I should retrieve several rows and collect the latest not None fields... just pondering

u'll have documents, and then for each document a bunch of versions.> Once get
it working on simple form, then perhaps trying optimicing

and feeding only field, that has changed. Version field automatic update was on my mind lately. Could it be something like this:

Column("version", Integer, default=1, nullable=False, onupdate=document_versions.select(document_versions.document_id=c.d ocument_id, order_by=version, order=DESC, limit=1)

no idea, what this onupdate is expected to do here?

It was meant to be oninsert, not onupdate, but on the other hand, if making system with mapper extension, i think i need to do before_update and increase version number there as well as making a new insert and halt doing update.

afaik these things are done with a mapper extension, but i'm not sure its the only way.

I'm going to try with mapper extension

what would be version field? something that counts the inserts for that particular document_id?

Yes, just a counter for every insert to document_id. I could use len(Versions) or get latest DocumentVersion.version+1