view scripts/dump_dbm_sessions_db.py @ 6599:39189dd94f2c

issue2551189 - increase size of words in full text index. Increased indexed word maxlength to 50 DB migration code is written and tests work. Restructured some tests to allow for code reuse. Docs. If this passes CI without errors 2551189 should be done. However, testing on my system generates errors. Encoding (indexer unicode russian unicode string invalid) and collation errors (utf8_bin not valid) when running under python2. No issues with python3 and I haven't changed code that should cause these since the last successful build in CI. So if this fails in CI we will have more checkins.
author John Rouillard <rouilj@ieee.org>
date Wed, 26 Jan 2022 15:04:09 -0500
parents 61481d7bbb07
children 1188bb423f92
line wrap: on
line source

#! /usr/bin/env python3
"""Usage: dump_dbm_sessions_db.py [filename]

Simple script to dump the otks and sessions dbm databases.  Dumps
sessions db in current directory if no argument is given.

Dump format:

   key: <timestamp> data

where <timestamp> is the human readable __timestamp decoded from the
data object.

"""

import dbm, marshal, sys
from datetime import datetime

try:
  file = sys.argv[1]
except IndexError:
  file="sessions"

try:
   db = dbm.open(file)
except Exception:
   print("Unable to open database: %s"%file)
   exit(1)

k = db.firstkey()
while k is not None:
    d = marshal.loads(db[k])
    t = datetime.fromtimestamp(d['__timestamp'])
    print("%s: %s %s"%(k, t, d))
    k = db.nextkey(k)

Roundup Issue Tracker: http://roundup-tracker.org/