Heyho! My small blog-style web site should support article versioning, so:
class Entry(DeclarativeBase): id = Column(Integer, autoincrement=True, primary_key=True) version = Column(Integer, primary_key=True, default=0) ... and more stuff (content, author, ...) it seems autoincrement is not supported in this case. (I'm working in a TurboGears 2 environment with SQLite; final deployment will probably be with PostgreSQL) At least, when trying to populate a db from TurboGear's "pasteer set-up", I get an IntegrityError ("id may not be NULL") and see that id is not set in the INSERT statement. Just removing the version column from the Entry class suffices to let it work as before. Additionally: to keep the queries simple and fast, I'll introduce a "current" flag which should be set to True for the latest version of any id. Are there hooks I can use to manage this? (something like: execute "UPDATE ... set current = False where version < myversion" whenver an Entry is being added to the db with a version > 0) And a third qestion: what is the easiest way to create a new version? copy my 'Entry' object element by element to a new instance, or does sqla provide a cloning mechanism? thanks a lot! cheers -- vbi -- SCO's lawsuit is a lost cause. The implications for Linux users are rather like the implications for passengers on an ocean liner of a seagull diving into the water nearby. -- Thomas Carey, Bromberg & Sunstein, LLP, attorney
signature.asc
Description: This is a digitally signed message part.