[ZODB-Dev] Can iterate thru records - but cannot access same record directly by key
tsmiller
tsmiller at gnixterhouse.com
Wed Dec 28 18:11:18 UTC 2011
Jim,
1) I define a Database class, which is where I get the "db" in db.dataConn
2) My ZODB version is ZODB3-3.10.3
3) The storage is FileStorage
thanks,
tom
THE CLASS DEFINITiON
##
## database class
##
class Database:
def open( self ):
self.tm = transaction
print "opening dbmaker.fs"
storage = FileStorage('zodb/dbmaker.fs')
db = DB(storage)
connection = db.open()
self.dbRoot = connection.root()
print "opening accounts.fs"
storage = FileStorage('zodb/accounts.fs')
db = DB(storage)
connection = db.open()
self.accountsConn = connection.root()
print "opening databasehash.fs"
storage = FileStorage('zodb/databasehash.fs')
db = DB(storage)
connection = db.open()
self.databaseHashConn = connection.root()
print "opening info.fs"
storage = FileStorage('zodb/info.fs')
db = DB(storage)
connection = db.open()
self.infoConn = connection.root()
print "opening urlnames.fs"
storage = FileStorage('zodb/urlnames.fs')
db = DB(storage)
connection = db.open()
self.urlNamesConn = connection.root()
print "opening urldata.fs"
storage = FileStorage('zodb/urldata.fs')
db = DB(storage)
connection = db.open()
self.urlDataConn = connection.root()
print "opening basefields.fs"
storage = FileStorage('zodb/basefields.fs')
db = DB(storage)
connection = db.open()
self.baseFieldsConn = connection.root()
print "opening datamodel.fs"
storage = FileStorage('zodb/datamodel.fs')
db = DB(storage)
connection = db.open()
self.dataModelConn = connection.root()
print "opening state.fs"
storage = FileStorage('zodb/state.fs')
db = DB(storage)
connection = db.open()
self.stateConn = connection.root()
print "opening layouts.fs"
storage = FileStorage('zodb/layouts.fs')
db = DB(storage)
connection = db.open()
self.layoutsConn = connection.root()
print "opening exportlayouts.fs"
storage = FileStorage('zodb/exportlayouts.fs')
db = DB(storage)
connection = db.open()
self.exportLayoutsConn = connection.root()
print "opening itemlists.fs"
storage = FileStorage('zodb/itemlists.fs')
db = DB(storage)
connection = db.open()
self.itemListsConn = connection.root()
print "opening data.fs"
storage = FileStorage('zodb/data.fs')
db = DB(storage)
connection = db.open()
self.dataConn = connection.root()
print "opening audit.fs"
storage = FileStorage('zodb/audit.fs')
db = DB(storage)
connection = db.open()
self.auditConn = connection.root()
print "opening sessions.fs"
storage = FileStorage('zodb/sessions.fs')
db = DB(storage)
connection = db.open()
self.sessionsConn = connection.root()
print "opening previews.fs"
storage = FileStorage('zodb/previews.fs')
db = DB(storage)
connection = db.open()
self.previewsConn = connection.root()
INSTANTIATE THE CLASS
db = Database()
db.open()
Jim Fulton wrote:
>
> On Tue, Dec 27, 2011 at 9:36 PM, tsmiller <tsmiller at gnixterhouse.com>
> wrote:
>>
>> I have a problem that occurs sporadically, and I do not have a clue why
>> it
>> happens. When I restart my cherrypy python server using ZODB3 I cannot
>> access records that were previously written to the database. The ZODB3
>> database works fine for a long time (weeks) and then it seems that
>> something
>> internal happens to the ZODB3 and the saved changes start screwing up.
>> The
>> data exists because I can iterate through it and print out the records,
>> but
>> if I try to access the record directly via the key - then I get a
>> KeyError.
>>
>> Please see the code below and its output. My keys are all character and
>> in
>> this case, all of my records with an item id greater than 6198 exist in
>> the
>> database, but I cannot access them. Can someone put me on a path to
>> enlightenment!
>>
>> thanks,
>>
>> tom
>>
>> base = db.dataConn["1292289873"]["books"]["1292289873"]
>
> What is db?
>
> What version of ZODB are you using?
>
> What Storage?
>
> Jim
>
> --
> Jim Fulton
> http://www.linkedin.com/in/jimfulton
> _______________________________________________
> For more information about ZODB, see http://zodb.org/
>
> ZODB-Dev mailing list - ZODB-Dev at zope.org
> https://mail.zope.org/mailman/listinfo/zodb-dev
>
>
--
View this message in context: http://old.nabble.com/Can-iterate-thru-records---but-cannot-access-same-record-directly-by-key-tp33044095p33046794.html
Sent from the Zope - ZODB-Dev mailing list archive at Nabble.com.
More information about the ZODB-Dev
mailing list