Questions tagged [shelve]

Shelve can refer to either a Python object persistence or a pending change in a Visual Studio Workspace

A shelf in Python is a persistent, dictionary-like object. Documentation: shelve

Shelve can also refer to a pending change in the workspace within Visual Studio 2005

351 questions
4
votes
1 answer

Prevent python shelve corruption

How should I prevent corruption in a shelve file? Should the shelve be closed most of the time and then opened only when I need to read or edit a value?
MKaras
  • 2,063
  • 2
  • 20
  • 35
4
votes
1 answer

Does linux disk buffer cache make python cPickle more efficient than shelve?

Is IO more efficient, due to the linux disk buffer cache, when storing frequently accessed python objects as separate cPickle files instead of storing all objects in one large shelf? Does the disk buffer cache operate differently in these two…
ricopan
  • 662
  • 6
  • 13
4
votes
2 answers

How to display all data in shelve in order?

This is the first time I post in stack overflow. Perhaps I can get the solution that I need. busdata=shelve.open("Database") for lctno in busdata.keys(): outputLine( lctno , busdata[ lctno ]) It randomly display the data in my .dat file. I want…
Triple K
  • 93
  • 2
  • 5
4
votes
1 answer

why does converting a python 'shelve' to 'dict' use so much memory?

I have a very large python shelve object (6GB on disk). I want to be able to move it to another machine, and since shelves are not portable, I wanted to cPickle it. To do that, I first have to convert it to a dict. For some reason, when I do…
pocketfullofcheese
  • 8,427
  • 9
  • 41
  • 57
4
votes
2 answers

assign a shelved changlist in perforce?

I'm really excited about Perforce's new shelve command. They say that you should be able to "reassign" the changelist to someone else, who can then unshelve it. How do I reassign a shelved changelist? Is there a way to do it in p4v, or only at the…
Denise
  • 1,947
  • 2
  • 17
  • 29
4
votes
1 answer

Is there a Haskell equivalent to Python's `shelve` for transparent persistence?

Python has this magical shelve which is like a dict except it's automatically backed by a file. It allows you to persist a large data structure between runs of a program. The really amazing thing is that it doesn't even load the whole thing from…
Michael Fox
  • 3,632
  • 1
  • 17
  • 27
4
votes
1 answer

Reverting a unsubmitted changelist after shelving p4

I have a changelist with large number of files. I have to work on other request so I shelved the changes using p4 shelve -c 899. But when I do a p4 opened the files are still showing up in workspace. Since the number is large I want to revert all…
Aman Deep Gautam
  • 8,091
  • 21
  • 74
  • 130
4
votes
1 answer

Is it possible to get shelve database filename using file object attribute? (python)

I have a python3 script that creates multiple database files using the shelve module. FYI, the shelve module wraps the dbm module, as can be seen in the shelve source code. The shelf.open() method is used to create the database file on disc and…
Lionel Brooks
  • 258
  • 2
  • 7
4
votes
1 answer

Storing a 7millions keys python dictionary in a database

I have to handle a 7 millions keys dictionary (the number of keys can eventually be up to ~50 millions). Since I have barely enough ram to keep it in memory I've decided to store it. My dictionary looks like…
Raphael_LK
  • 199
  • 2
  • 13
4
votes
2 answers

equivalent to python's shelve module in Java

Is there any module in Java equivalent to python's shelve module? I need this to achieve dictionary like taxonomic data access. Dictionary-like taxonomic data access is a powerful way to save Python objects in a persistently easy access database…
Ali_IT
  • 7,551
  • 8
  • 28
  • 44
4
votes
2 answers

Mercurial: shelving committed files

I have two repos, dev and testing. In dev, I've made several commits since the last push to testing. However, now I want to shelve all those commits, make a different change, push it to testing, and then get those commits back. Shelving only…
Kev
  • 15,899
  • 15
  • 79
  • 112
4
votes
2 answers

updating a shelve dictionary in python parallely

I have a program that takes a very huge input file and makes a dict out of it. Since there is no way this is going to fit in memory, I Decided to use shelve to write it to my disk. Now I need to take advantage of the multiple cores available in my…
Amitash
  • 1,029
  • 6
  • 16
  • 26
3
votes
4 answers

Automatic shelve before pulling in Mercurial (with TortoiseHG)?

I have some changed files I don't want to commit (e.g. web.config). Before I pull and update to new changesets, I have to shelve them. After the pull & update, I have to unshelve them. I'm currently using TortoiseHG. Is there any extension which…
Jan-Patrick Ahnen
  • 1,380
  • 6
  • 17
  • 31
3
votes
1 answer

Shelve Code gives KeyError

I wanted to use the following code from here: How can I save all the variables in the current python session? import shelve T='Hiya' val=[1,2,3] filename='/tmp/shelve.out' my_shelf = shelve.open(filename,'n') # 'n' for new for key in dir(): …
user40974
  • 334
  • 1
  • 3
  • 11
3
votes
1 answer

python: container for card catalog - sqlite, dict, other?

I'm developing a card catalog type application and Python and am trying to decide how to store the data. Not a web app. I don't expect a large app or a massive amount of data. One alternative is a pickled dictionary. For example {id1: {author1,…
foosion
  • 7,619
  • 25
  • 65
  • 102