revisit 'Right' way to delete rows from a view in python?

"William K. Volkman" <[email protected]>
Newsgroups gmane.comp.db.metakit
Message-ID <[email protected]>
I'm pondering the list archive however haven't yet spotted
something that explains this.  Given the below code, is
there anyway to delete just the rows selected by the filter?

db = metakit.storage('/var/tmp/test.mk',1)
vw = db.getas('test[f1:I,f2:s,seq:I,state:s]')
for i in xrange(5):
    vw.append((i,'%d'%i,99,'F'))
    num = random.randint(0,4)
    if num > 0:
        for s in range(num):
            vw.append((i,'%d'%i,s,'%d'%s))
    db.commit()
metakit.dump(vw)

pickon = random.randint(0,4)
print "******** Entry to pick on",pickon

subvw = vw.select(f1=pickon)
rs = subvw.filter(lambda row: row.state == 'F')
subsubvw = subvw.remapwith(rs)
metakit.dump(subsubvw)
#
## Now I want remove the filter rows, how can I back track?
#
## If I use
##vw.remove(rs)
## It only works if order is perfect
#
## The delete and remove methods are not available on the derived views
##subvw.remove(rs)
##subsubvw.remove(rs)
#
vw.remove(vw.indices(subvw))
# Deletes all 'pickon' records, not just the ones in state 'F'

Like the poster in January, I'm banging my head on my desk.
Metakit 2.4.9.3 on linux RH9 (with python 2.2)


_____________________________________________
Metakit mailing list  -  [email protected]
http://www.equi4.com/mailman/listinfo/metakit
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.