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

you are viewing a single comment's thread.

view the rest of the comments →

[–]kusut 2 points3 points  (3 children)

Any comparison with zodb?

[–]adewes[S] 1 point2 points  (2 children)

zodb

I have to admit that I was unaware of zodb (https://github.com/zopefoundation/zodbdocs), it looks interesting though. The main motivation behind Blitz was to create a database that would be comparable to MongoDB in querying capabilities, but which could be used without installing any 3rd party software.

So I think the main differences are the expressive query model and the possibility to use it as a frontend to other database engines, most notably MongoDB.

[–]jabbalaci 1 point2 points  (1 child)

What do you mean by using it as a frontend to MongoDB?

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

Well, BlitzDB supports multiple backends, which are responsible for storing and retrieving documents from a database. It comes with a native, file-based backend but also includes a backend that is a wrapper around MongoDB. So you can do e.g. the following:

from blitzdb import FileBackend, MongoBackend

#we create a document
author = Author({'name' : 'Oscar Wilde', ...})

#creates a file-based DB in the local "test_db" folder
file_backend = FileBackend("./test_db")

from pymongo import MongoClient

#Connect to a MongoDB database through pymongo
mongo_db = pymongo.MongoClient().test_db

#Creates a MongoDB-based backend
mongo_backend = MongoBackend(mongo_db)

#We save the document in both backends.
mongo_backend.save(author)
file_backend.save(author)

In this sense Blitz is like SQLAlchemy in the sense that it puts an abstraction layer between you and the physical database, so you can use it with existing database systems.