Question

I want to experiment/play around with non-relational databases, it'd be best if the solution was:

  • portable, meaning it doesn't require an installation. ideally just copy-pasting the directory to someplace would make it work. I don't mind if it requires editing some configuration files or running a configuration tool for first time usage.
  • accessible from python
  • works on both windows and linux

What can you recommend for me?

Essentially, I would like to be able to install this system on a shared linux server where I have little user privileges.

Was it helpful?

Solution

I recommend you consider BerkelyDB with awareness of the licensing issues.

I am getting very tired of people recommending BerkleyDB without qualification - you can only distribute BDB systems under GPL or some unknown and not publicly visible licensing fee from Oracle.

For "local" playing around where it is not in use by external parties, it's probably a good idea. Just be aware that there is a license waiting to bite you.

This is also a reminder that it is a good idea when asking for technology recommendations to say whether or not GPL is acceptable.

From my own question about a portable C API database, whilst a range of other products were suggested, none of the embedded ones have Python bindings.

OTHER TIPS

Metakit is an interesting non-relational embedded database that supports Python.

Installation requires just copying a single shared library and .py file. It works on Windows, Linux and Mac and is open-source (MIT licensed).

If you're used to thinking a relational database has to be huge and heavy like PostgreSQL or MySQL, then you'll be pleasantly surprised by SQLite.

It is relational, very small, uses a single file, has Python bindings, requires no extra priviledges, and works on Linux, Windows, and many other platforms.

Have you looked at CouchDB? It's non-relational, data can be migrated with relative ease and it has a Python API in the form of couchdb-python. It does have some fairly unusual dependencies in the form of Spidermonkey and Erlang though.

As for pure python solutions, I don't know how far along PyDBLite has come but it might be worth checking out nonetheless.

BerkeleyDB : (it seems that there is an API binding to python : http://www.jcea.es/programacion/pybsddb.htm)

Have you looked at Zope Object Database?

Also, SQLAlchemy or Django's ORM layer makes schema management over SQLite almost transparent.


Edit

Start with http://www.sqlalchemy.org/docs/05/ormtutorial.html#define-and-create-a-table to see how to create SQL tables and how they map to Python objects.

While your question is vague, your comments seem to indicate that you might want to define the Python objects first, get those to work, then map them to relational schema objects via SQLAlchemy.

If you're only coming and going from Python you might think about using Pickle to serialize the objects. Not going to work if you're looking to use other tools to access the same data of course. It's built into python, so you shouldn't have any privileged problems, but it's not a true database so it may not suit the needs of your experiment.

Adding a reference to TinyDB here since this page is showing at the top of many searches. It is a portable non-relational database in python. It stores python dicts into a local json file and makes them available for database ops similar to mongodb. It also has an extension to port to mongodb's commands, the difference being that instead of working on another system server you'll be operating on a local json file.

And unlike the presently chosen answer, it is under a permissive MIT open license.

Links:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top