I'm just learning how to use this. So it's possible I've overlooked
something. But this behavior is rather puzzling.
I've created a MK database (using Python) with a rather simple view and a
hash view on top of it. On entry to my application, the contents are
checked and information is displayed. This works fine.
Then, just as a test, I call a method in my application that gets each
entry in the database, updates it, and puts it back -- at least that's what
I think I'm doing.
What I notice is that each time I run the application the database file
gets larger (by 2K) -- even though my code is not adding any new rows. Why
is the file size growing? What am I overlooking?
Also, it occurred to me that in the code below I might be misusing 'getas'
to access the existing view. But when I attempt to use 'view', it seems to
return a valid Python object whether the named view exists or not!! So how
can I tell whether the view is really there? (I guess I can attempt some
kind of try/except access to the retirmed view, but that seems *really*
kludgy.)
Any help will be appreciated.
The row format for the underlying view is 'Index[name:S,index:M]'
The code for opening the database and setting up the view and hash view is:
indexInfoFileName = join(indexDir, IndexInfoFileName)
self.InfoDb = mk.storage(indexInfoFileName, 2)
basicInfoView = self.InfoDb.getas(IndexInfoViewFmt)
infoHashView = self.InfoDb.getas(IndexInfoHashFmt)
self.InfoView = basicInfoView.hash(infoHashView, 1)
self.InfoDb.commit()
The code for updating looks like the following. As you can see, it
attempts to modify existing rows and append new ones as necessary
for infoInstance in self.itemsData:
rowIdx = self.InfoView.find(name=infoInstance.indexName)
binIndex = dumps(infoInstance, 1)
if rowIdx >= 0:
self.InfoView[rowIdx].index = binIndex
else:
self.InfoView.append(name=infoInstance.indexName,
index=binIndex)
self.InfoDb.commit()
--------------------------------------
Gary H. Merrill
Director and Principal Scientist, New Applications
Data Exploration Sciences
GlaxoSmithKline Inc.
(919) 483-8456
_______________________________________________
metakit mailing list - [EMAIL PROTECTED]
http://www.equi4.com/mailman/listinfo/metakit