473,396 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

berkeley db delete problem?

Hi all,

Probably my fault, I'm opening a Berkeley DB
file, iterating through and deleting keys, well
making an attempt. I get this error when I try
to delete.

---error
Traceback (most recent call last):
File "./db.py", line 41, in ?
db.delete()
AttributeError: delete
---end error

Below is a code snippet:
---code
#!/usr/bin/python

import bsddb

db = bsddb.btopen('./test.db', 'r')

rec = db.first()
while rec:
key, val = rec
db.delete()
rec = db.next()

db.close()
---end code

I have full code that opens and goes through and
prints the key and value and opens another db
file and inserts the key/data into that new db
file, but I need to delete the data out of the
master db file once it's been updated in the
smaller ones.

I've also tried db.delete(key) with no luck,
db.del(), db.del(key), db[key]='', and lots of
other silly attempts, but nothing works.

Thanks,
Oliver

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Jul 18 '05 #1
2 2534
Oliver Peek wrote:
Hi all,

Probably my fault, I'm opening a Berkeley DB
file, iterating through and deleting keys, well
making an attempt. I get this error when I try
to delete.

---error
Traceback (most recent call last):
File "./db.py", line 41, in ?
db.delete()
AttributeError: delete
---end error

Below is a code snippet:
---code
#!/usr/bin/python

import bsddb

db = bsddb.btopen('./test.db', 'r')

rec = db.first()
while rec:
key, val = rec
db.delete()
rec = db.next()

db.close()
---end code

I have full code that opens and goes through and
prints the key and value and opens another db
file and inserts the key/data into that new db
file, but I need to delete the data out of the
master db file once it's been updated in the
smaller ones.

I've also tried db.delete(key) with no luck,
db.del(), db.del(key), db[key]='', and lots of
other silly attempts, but nothing works.

Thanks,
Oliver

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


Oliver,
Does clear() work?
wes

Jul 18 '05 #2
Oliver Peek wrote:
Hi all,

Probably my fault, I'm opening a Berkeley DB
file, iterating through and deleting keys, well
making an attempt. I get this error when I try
to delete.

---error
Traceback (most recent call last):
File "./db.py", line 41, in ?
db.delete()
AttributeError: delete
---end error

Below is a code snippet:
---code
#!/usr/bin/python

import bsddb

db = bsddb.btopen('./test.db', 'r')

rec = db.first()
while rec:
key, val = rec
db.delete()
rec = db.next()

db.close()
---end code

I have full code that opens and goes through and
prints the key and value and opens another db
file and inserts the key/data into that new db
file, but I need to delete the data out of the
master db file once it's been updated in the
smaller ones.

I've also tried db.delete(key) with no luck,
db.del(), db.del(key), db[key]='', and lots of
other silly attempts, but nothing works.

Thanks,
Oliver

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


Oliver,
How bout del db[key]
wes

Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dan Olsen | last post by:
I am trying to install and use Berkeley XML DB with Python. However, I keep getting errors. The weblog at Sleepy Cat said to build Python with the latest version of Berkeley DB. I can't get it to...
2
by: Wojtek | last post by:
Hi I'm writing multiprocess server which has to gather information from the clients and store it to berkeley db. The problem is that BerkeleyDB adds entries to the base only if they are added from...
3
by: HerbAsher | last post by:
Hi! I have some questions. I'm evaluating berkeley db as a embeddable storage engine for a project I'm working on. My questions: 1. Now that Berkeley DB is part of Oracle, is it still...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.