hi.
For those interested, i've put a bitemporal mixin class under
dbcook/misc/timed2/. It handles Objects with multiple versions
(history), disabled/enabled state, and stays sane with
same-timestamp-versions.
The available queries are:
- get_time_clause( times):
return the clause to get the object-version for that timestamps;
use to (further) filter some SA.query()
- klas.allinstances( times ):
return the last valid versions of all objects for the
(bitemporal) timestamp
- klas.get_obj_history_in_range( objid, fromtimes, totimes):
return all versions of that Object within given timesrange
It uses plain SA - as long as u maintain the required object
attributes, it should work no matter how they appeared (by
dbcook/elixir/whatever/manual).
Required attributes:
objid - this keeps track of which versions belong to same Object.
This should be incremented by special means, only when new Object is
made (and not when new version of existing Object)
time_trans, time_valid - the two temporal dimensions. can be
anything orderable - numbers, floats, strings, datetime, ...
disabled - a boolean
plus some class-setup is required, see begin of class Timed2Mixin.
It is there together with quite thorough test, and a complementary
timed/ library, containing things like timed1 and timed2
implementations over (python) sequences, timed* versioning support
for python modules, some timedcontext etc.
todo: as ever, some documentation, and simple examples
svn co
https://dbcook.svn.sourceforge.net/svnroot/dbcook/trunk/dbcook/misc/timed2/
https://dbcook.svn.sourceforge.net/svnroot/dbcook/trunk
http://dbcook.sourceforge.net/
ciao
svilen
p.s. something learned around minor fix in dbcook.usage.sa2static:
delattr( Myclass, attrname) calls Myclass' metaclass.__delattr__(),
probably same goes for setattr. Thus the setting and clearing of
InstrumentedAttributes can be controlled, maintaning/restoring the
overriden original descriptors if any.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---