Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Create a file that pretends to be a database query

Project Description

Create a file that pretends to be a MongoDB collection. If you try to open the file, it will JSONify the collection and dump it back to you.

Why?

Because our enterprise database is file based, but our cloud based database isn’t.

…no really why?

Files are simpler and don’t break. The database operations we need to perform aren’t complicated and don’t require high performance. By using files there isn’t a database that can fail. There’s the added benefit that if customers want to use different types of databases for distributed systems, we can plug into any of them using a filedb (we just have to make something that dumps out JSON .

Quickstart

Install FUSE

Make sure you have FUSE installed.

Get mongo running

And you’ll need a collection with some data in it.

$ mongod
$ mongo
> use test
> db.people.insert({"username": "greg"})
> db.people.insert({"username": "phil"})
> db.people.insert({"username": "bob"})
> db.people.insert({"username": "samantha"})

Install filedb

$ pip install filedb

Running via python

$ filedb /tmp/tutorial/mnt/ mongodb://localhost:27017/test people

Open the file

$ cat /tmp/tutorial/mnt/db
[{ "_id": "52f104a7a0fb769e0cd0d1d4", "username": "greg" }
{ "_id": "52f104a9a0fb769e0cd0d1d5", "username": "phil" }
{ "_id": "52f104aca0fb769e0cd0d1d6", "username": "bob" }
{ "_id": "52f104aea0fb769e0cd0d1d7", "username": "samantha" }]

Running as a service

Upstart job.

# install the job
$ sudo cp -R overlay/* /
# or
$ wget https://raw2.github.com/yhat/filedb/master/overlay/etc/init/filedb.conf
$ sudo mv filedb.conf /etc/init/filedb.conf
# start the job
$ sudo start filedb
Release History

Release History

This version
History Node

0.2.3

History Node

0.2.2

History Node

0.2.1

History Node

0.2

History Node

0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
filedb-0.2.3-py2.7.egg (5.2 kB) Copy SHA256 Checksum SHA256 2.7 Egg Feb 4, 2014
filedb-0.2.3.tar.gz (3.2 kB) Copy SHA256 Checksum SHA256 Source Feb 4, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting