Tutorial

 
Return to main page

Searching for all ZODB Transactions Later Than

Author: chrism
Date: 02/28/10 at 10:03:13

Find all ZODB FileStorage transactions later than some date.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
from ZODB.TimeStamp import TimeStamp
from ZODB.FileStorage import FileStorage

storage = FileStorage('/path/to/data.fs', read_only=True)
it = storage.iterator()

earliest = TimeStamp(2010, 2, 26, 6, 0, 0)
# the above is in GMT

for txn in it:
    tid = TimeStamp(txn.tid)
    if tid > earliest:
        print txn.user, txn.description, tid.timeTime(), txn.tid.encode('base64')
        for rec in txn:
            print rec.pos