473,769 Members | 2,085 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2562
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
2108
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 build with it. Does anyone have any good directions on how to get Berkeley XML DB running with Python? I have followed Sleepy Cat's installation instructions but have been unable to get it to work thus far. Dan
2
1947
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 the same proces within was created all is ok. But when I fork() it the code runs without any error, but DB adds nothnig :(. How can I solve this problem. Thank you in advance --
3
1731
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 being maintained? Is it free? 2. Are there good python libraries for bdb available, that are being
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9865
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8873
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5309
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.