[pybsddb] Deleting a specific key/data pair in a database with duplicate keys
denis.papathanasiou at gmail.com
denis.papathanasiou at gmail.com
Sat Dec 6 23:28:05 CET 2008
This is more of a pure Berkeley DB question than a bsddb3 one, but the
Berkeley mailing list is inactive, and I wondered whether or not anyone
here would know the answer.
I've created a database with duplicate keys by using
DB.set_flags(db.DB_SUP | db.DB_DUPSORT) and it works as expected.
While I can use DB.get_both() to pick out a specific key/data pair, is
there an equivalent method to delete a specific key/value pair, leaving
all the other values for the given key intact?
DB.delete() will delete everything with a specific key, which is what I
don't want.
I also tried DB.get_both(key, value, None, db.DB_CONSUME), thinking that
once get_both() picks out the specific key/value pair, DB_CONSUME will
remove it, but the database complained that DB_CONSUME was an illegal
flag for that method.
Is there another way to do this?
More information about the pybsddb
mailing list