Skip to main content

Serverless self-contained database with pymongo interface

Project description

pyfongo

pyfongo is an in-process library that implements a self-contained, serverless, zero-configuration, mongodb database engine with pymongo's interface.

Inspired by pymongo and sqlite.

Written for Python 3.6.

When to use

  • unit testing of apps that use mongodb
  • stand-in for mongodb during demos and testing
  • as application file format
  • data analysis using mongodb queries
  • temporary database for reorganizing data
  • in embedded systems

Examples

>>> import pyfongo
>>> cx = pyfongo.FongoClient('/path/to/datadir')
>>> db = cx.test
>>> db.my_collection.insert_one({'x': 10}).inserted_id
ObjectId('5aded7ff7aea217b9056e9d0')
>>> db.my_collection.insert_one({'x': 12}).inserted_id
ObjectId('5aded8467aea217b9056e9d1')
>>> db.my_collection.find_one()
{'x': 10, '_id': ObjectId('5aded7ff7aea217b9056e9d0')}
>>> for item in db.my_collection.find().sort('x', -1):
...     print(item['x'])
...
12
10

Testing

The same tests are run against both pyfongo and a local mongodb server using pymongo to ensure that pyfongo mimics mongodb/pymongo's behavior correctly.

Run the tests with: pipenv run pytest -sv

Note that you will need to run pipenv install --dev once before you can run the tests.

Project details


Download files

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

Source Distribution

pyfongo-0.1.0.tar.gz (5.1 kB view details)

Uploaded Source

File details

Details for the file pyfongo-0.1.0.tar.gz.

File metadata

  • Download URL: pyfongo-0.1.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyfongo-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ff2c5cba2d56e5735816267606c5e1672752a076ad5cbed71dfcd8422c94df11
MD5 6c41b1ad3d69e7e46192887602f74914
BLAKE2b-256 7b40bf01522621e5497870eb45a89795faf6bc63600c486e72eef6f7e4cc0aab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page