All Projects → nimeshkverma → Mongo_schema

nimeshkverma / Mongo_schema

Licence: mit
Python Package to provide a rough schema for the mongodb collection

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Mongo schema

Modern Django
Modern Django: A Guide on How to Deploy Django-based Web Applications in 2017
Stars: ✭ 662 (+8175%)
Mutual labels:  pip
Schema Org
A fluent builder Schema.org types and ld+json generator
Stars: ✭ 894 (+11075%)
Mutual labels:  schema
Gin Stats
Gin's middleware for request stats
Stars: ✭ 24 (+200%)
Mutual labels:  stats
Eralchemy
Entity Relation Diagrams generation tool
Stars: ✭ 767 (+9487.5%)
Mutual labels:  schema
Strictyaml
Type-safe YAML parser and validator.
Stars: ✭ 836 (+10350%)
Mutual labels:  schema
Cafy
☕️ Simple, lightweight, flexible validator generator
Stars: ✭ 22 (+175%)
Mutual labels:  schema
Marshmallow
A lightweight library for converting complex objects to and from simple Python datatypes.
Stars: ✭ 5,857 (+73112.5%)
Mutual labels:  schema
Wp Structuring Markup
🔌 WordPress: Plug-in Markup (JSON-LD) structured in schema.org
Stars: ✭ 26 (+225%)
Mutual labels:  schema
Mithril Data
A rich data model library for Mithril javascript framework
Stars: ✭ 17 (+112.5%)
Mutual labels:  schema
Ultimate Metatags
A large snippet for your page's <head> that includes all the meta tags you'll need for OPTIMAL sharing and SEO. Extensive work has been put into ensuring you have the optimal images for the most important social media platforms.
Stars: ✭ 24 (+200%)
Mutual labels:  schema
Schemats
Generate typescript interface definitions from SQL database schema
Stars: ✭ 799 (+9887.5%)
Mutual labels:  schema
Leaflet.annotate
A Leaflet plugin integrating schema.org to markup items in your geographic web map machine readable.
Stars: ✭ 5 (-37.5%)
Mutual labels:  schema
Fastest Validator
⚡️ The fastest JS validator library for NodeJS
Stars: ✭ 923 (+11437.5%)
Mutual labels:  schema
Type Graphql
Create GraphQL schema and resolvers with TypeScript, using classes and decorators!
Stars: ✭ 6,864 (+85700%)
Mutual labels:  schema
Valley
Extensible schema validations and declarative syntax helpers in Python.
Stars: ✭ 25 (+212.5%)
Mutual labels:  schema
Opencensus Java
A stats collection and distributed tracing framework
Stars: ✭ 640 (+7900%)
Mutual labels:  stats
Protobuf Convert
Macros for convenient serialization of Rust data structures into/from Protocol Buffers 3
Stars: ✭ 22 (+175%)
Mutual labels:  schema
Serverless Python Requirements
⚡️🐍📦 Serverless plugin to bundle Python packages
Stars: ✭ 838 (+10375%)
Mutual labels:  pip
Merge Graphql Schemas
A utility library to facilitate merging of modularized GraphQL schemas and resolver objects.
Stars: ✭ 935 (+11587.5%)
Mutual labels:  schema
Django Rest Booking Api
A Restful api which allows you to book sports events or update existing odds.
Stars: ✭ 24 (+200%)
Mutual labels:  pip

mongoschema

MongoDB schema information in Python

mongoschema is a library written in Python to provide concise description of the schema of a collection in MongoDB

Installation


To install the package, type the following -

pip install mongoschema

Sample data - Populating MongoDB with sample data


Navigate to test/sample_data in the mongojoin directory and type the following command -

> mongoimport --dbname test --collection supplier --file supplier.json
> mongoimport --dbname test --collection order --file order.json

This will create and populate the required collections with sample data.

The two collections supplier and order will be used to demonstrate how to use mongoschema. To check the contents of the collection, the following command can be used in the MongoDB shell :

> use test
> db.supplier.find({})
> db.order.find({})

Using mongoschema to get the schema information of a MongoDB collections


Type the following in Python shell to import mongoschema-

>>> from mongoschema import Schema

To create a Schema object for the collection to be analysed, type the following -

>>> schema = Schema("test", "supplier")

where test is the DB name and supplier is the Collection name.

Additional parameters - host : Mongo uri (String) port : Port Number (Integer) limit: Number of docs to be sampled

To get the stats of the collection -

>>> num_docs, result = schema.get_schema()

num_docs: Total number of docs sampled result : Dictionary containing the stats

Use the following command to pretty print the results -

>>> schema.print_schema()


+-------------+------------------+-----------------------+------------------+-----------------------+
|   Key       | Occurrence Count | Occurrence Percentage |    Value Type    | Value Type Percentage |
+-------------+------------------+-----------------------+------------------+-----------------------+
| supplier_id |        7         |         100.0         |   <type 'int'>   |         100.0         |
|     name    |        7         |         100.0         | <type 'unicode'> |         100.0         |
|     _id     |        7         |         100.0         |      other       |         100.0         |
+-------------+------------------+-----------------------+------------------+-----------------------+

More contents here - https://pypi.python.org/pypi/mongoschema/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].