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!

Schema extractor for MongoDB.

Project Description
# Schema extractor for MongoDB

Mongo-inspector is a Python library that analyses the data of a MongoDB
database to extract its "schema" (I know...).

## Installation

$ pip install mongo-inspector

## Usage

import mongo_inspector
schema = mongo_inspector.extract_schema(
db_name='mydb',
host='myhost', # optional: default 'localhost'
port=xxxx # optional: default 27017
)

The returned schema looks like that:

{
u'SomeCollection': [
Attribute(name=u'id', types=[u'String']),
Attribute(name=u'someattribute', types=[u'String'])
],
u'AnotherCollection': [
Attribute(name=u'_id', types=[u'ObjectId']),
Attribute(name=u'someattr', types=[u'Object']),
Attribute(name=u'someattr.nested', types=[u'Number']),
Attribute(name=u'somelist', types=[u'Array']),
Attribute(name=u'somelist.__item__', types=[u'Object']),
Attribute(name=u'somelist.__item__.nested',
types=[u'String', u'Number'])
]
}

`Attribute(name, types)` is just a `nametuple`. Each attribute can have
several types.

## Future

* It might be usefull to return a tree instead of 'point-separated'
nested keys.
Release History

Release History

This version
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
mongo-inspector-0.2.tar.gz (3.5 kB) Copy SHA256 Checksum SHA256 Source Jul 27, 2013
mongo-inspector-0.2.zip (5.8 kB) Copy SHA256 Checksum SHA256 Source Jul 27, 2013

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