Support blitzdb as a backend

Issue #13 resolved
Chris Mutel
repo owner created an issue

BlitzDB is an interesting file-based (JSON) database with indices and advanced queries.

Example code to import a database:

from brightway2 import *
import blitzdb
ei = Database("ecoinvent 2.2").load()

be = blitzdb.FileBackend(config.request_dir("blitz"))

def reformatter(key, value):
    value[u"!key"] = key[1]
    value[u"!db"] = key[0]
    return value

class Dataset(blitzdb.Document):
    pass

for key, value in ei.items():
    Dataset(reformatter(key, value)).save(be)

be.commit()

Comments (1)

  1. Log in to comment