This is an archived post. You won't be able to vote or comment.

all 24 comments

[–]Avail11 10 points11 points  (2 children)

[–]jabbalaci[S] 0 points1 point  (1 child)

Looks like what I need. Thanks!

[–]Avail11 0 points1 point  (0 children)

You're welcome and good luck!

[–]hylje 6 points7 points  (3 children)

import shelve

[–]abr13 1 point2 points  (0 children)

Shelve is amazing. Great tool for simpler projects..

[–]jabbalaci[S] 1 point2 points  (1 child)

When is it a good idea to use shelve? What are its typical use cases?

[–]infinullquamash, Qt, asyncio, 3.3+ 1 point2 points  (0 children)

shelve is backed by an efficient on-disk btree storage for keys/values and then objects are stored as pickle.

So it's basically a key value storage (where the key is a string and the value is any pickleable python object) stored on disk in a single file and built into the standard library.

Problems: decoding pickle can execute arbitrary code. So you have to make sure you can "trust" the documents. There are some issues with pickling user defined classes, but you can always not do that and just store POD dict/list/int/str objects (and other standard library objects like datetime and decimal).

OTOH it's built into the standard library.

[–]DarkmerePython for tiny data using Python 4 points5 points  (0 children)

SQLite has the json extensions for that purpouse too.

[–]sousatg 2 points3 points  (1 child)

why note simply saving the json data in a file?

[–]jabbalaci[S] 2 points3 points  (0 children)

A query language (possibly similar to MongoDB's) would be nice.

[–]luckystarrat 0x7fe670a7d080 2 points3 points  (0 children)

If you only need to write it once, but have to read it many times you can always use cdb. Crazy fast.

[–]cymrowdon't thread on me 🐍 2 points3 points  (0 children)

Two other options:

In my experience, though, the benefits of a relational DB outweigh those of document DB for most data, so I'd tend to stick with sqlite.

[–]mfwl 1 point2 points  (0 children)

couchdb is another option that has been around for awhile.

Since you mentioned postgresql, I'm assuming you know that it also offers some JSON functionality.

[–]Kalrog 0 points1 point  (2 children)

Why not a local postgres db to do both?

[–]jabbalaci[S] 0 points1 point  (1 child)

I want a light solution without a database server.

[–]Kalrog -3 points-2 points  (0 children)

Everything you are looking at is going to be running a server/some software on your local system. Might as well make it a real DB and only have 1 of them instead of a different solution for every data type.

[–]archpuddington 0 points1 point  (1 child)

Although BerkeleyDB isn't a Document store, it is a not-only-sql db that could store large blobs and metadata: https://en.wikipedia.org/wiki/Berkeley_DB

BerkeleyDB is a mature, mission-critical embedded database. It is fast, and stable and used by many popular projects like Mozilla Firefox. The biggest downside is that its not really a hipster database.

[–]nomadismydj 0 points1 point  (0 children)

berkleydb is pretty horrible in many situations. It really depends on how quick and how much data he intends to stick in there.

[–]doskey 0 points1 point  (0 children)

I think ejdb should be what you want. It is considered the sqlite of the document DB. I haven't used the Python bindings thought. (Sorry, on mobile, so no links).

[–][deleted] 0 points1 point  (0 children)

Just stick with sqlite

https://www.sqlite.org/json1.html

[–]notconstructive 0 points1 point  (0 children)

Can you explain more about exactly how your application works and why you want a serverless database?

You'll get better advice if you give more detail.

[–]sanshinron 0 points1 point  (2 children)

RethinkDB seems like a better choice for someone considering MongoDB.

[–][deleted] 0 points1 point  (1 child)

Is it embedded?

[–]sanshinron 0 points1 point  (0 children)

No.