Doh. Just what I needed. I kept reading past it in the doc. Thanks! (my forehead appreciates it too.)
-----Original Message----- From: Brian Kelley [mailto:[EMAIL PROTECTED] Sent: Thursday, January 22, 2004 2:06 PM To: Guy Umbright; Metakit mailing list Subject: Re: [Metakit] 'Right' way to delete rows from a view in python? Guy Umbright wrote: >Given the following bit of python setup code: > ><code> >db = metakit.storage("mkdelete.mk",1) >mainView = db.getas("program[key:S,val1:I,val2:I]") > > >aView = mainView.select(key='aaa') ></code> > >what is the 'right' way to delete the records in aView >from mainView (in python)? > >Banging my head on the desk on this.... > > > I think this is the way: indices = mainView.indices(aView) mainView.remove(indices) Here is a test script I just typed into the interpreter >>> import metakit >>> st = metakit.storage() >>> view = st.getas("test[a,b:I]") >>> for num, s in enumerate("abcdefg"): ... view.append((s, num)) ... >>> s = view.select(a='a') >>> indices = view.indices(s) >>> view.remove(indices) >>> metakit.dump(view) a b - - b 1 c 2 d 3 e 4 f 5 g 6 - - Total: 6 rows >>> This electronic mail message and any attached files contain information intended for the exclusive use of the individual or entity to whom it is addressed and may contain information that is proprietary, privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any viewing, copying, disclosure or distribution of this information may be subject to legal restriction or sanction. Please notify the sender, by electronic mail or telephone, of any unintended recipients and delete the original message without making any copies. _____________________________________________ Metakit mailing list - [EMAIL PROTECTED] http://www.equi4.com/mailman/listinfo/metakit
