Skip to main content

A NOSQL DB Library for Python

Project description

PyNOSQL Library for Python

Build Status

Summary

PyNOSQL is a simple library that wraps two popular NOSQL databases DynamoDB|MongoDB and provides the concept of a model for maintaining, expanding, and reducing data structures stored in NOSQL tables. Extend model.Model and pass to various Dynamo operations to benefit from default values, adding/removing elements, and simplifying use of boto3 with DynamoDB.

Versions

0.0.1 - Support for basic CRUD operations in DynamoDB 0.0.2 - Support for basic update of model with GET|PUT 0.0.3 - Support for NotFound on single record and empty list for multiple records

Getting Started

  1. Instantiate a client and pass to the desired provider:

    
    from pynosql.credentials.aws import AWSCredentials
    from pynosql.clients.aws import AWSClient
    from pynosql.providers.dynamo import DynamoDBProvider
    
    credentials = AWSCredentials(
        'AKIAIOSFODNN7EXAMPLE',
        'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'
    )
    
    dynamo = DynamoDBProvider(
        AWSClient(self.credentials, 'us-west-2')
    )
    
    
  2. Extend base.model.Model to create the desired data structure to be stored in your NOSQL DB:

    
    from pynosql.base.model import Model
    
    class TestModel(Model):
    
        BASE = {
            'test1': None,
            'test2': None,
            'test3': None,
            'test4': None
        }
    
        def __init__(self):
            super(TestModel, self).__init__(self.BASE)
    
    
  3. Pass the model with the appropriate call to DynamoDB:

    
    key = {
        'test1': 'value1',
        'test2': 'value2'
    }
    
    response = dynamo.get_record(TestModel(), 'TestTable', Key=key)
    
    
  4. For paginating all results into the model, just keep passing the model instance into your DynamoDB calls. The new records will be appended to the list within the model.

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

pynosql-0.0.3.tar.gz (8.7 kB view details)

Uploaded Source

Built Distributions

pynosql-0.0.3-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

pynosql-0.0.3-py2-none-any.whl (15.4 kB view details)

Uploaded Python 2

File details

Details for the file pynosql-0.0.3.tar.gz.

File metadata

  • Download URL: pynosql-0.0.3.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2

File hashes

Hashes for pynosql-0.0.3.tar.gz
Algorithm Hash digest
SHA256 e424d19728289aa14c7930ab77da8e4bb9592055860bf7a847bf8a98fbccdf16
MD5 a60810a01057db2b1f5ea67ed9d1bc10
BLAKE2b-256 f242448aa41034fa3a2bfdc90123284094d939be61429204db2aa3caf2938ea9

See more details on using hashes here.

File details

Details for the file pynosql-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: pynosql-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2

File hashes

Hashes for pynosql-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 938a5e43ce9a5ffafbc5c058fc08271681f01b0964b73f7f5720e45c28dd36cf
MD5 0a7207c4ed5cd7d614efd9839db677f9
BLAKE2b-256 2f4567d9824ad0adcda165cdf50176ed844057b8fc96337337a9bf83a0d98336

See more details on using hashes here.

File details

Details for the file pynosql-0.0.3-py2-none-any.whl.

File metadata

  • Download URL: pynosql-0.0.3-py2-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2

File hashes

Hashes for pynosql-0.0.3-py2-none-any.whl
Algorithm Hash digest
SHA256 d1676feb65951c75518ef59d1fd35e7dd6b1defd46d6f48378fff8ad37ff83e1
MD5 5563c3825a76dfd37108f14b742738f8
BLAKE2b-256 7253e040730adcc6f58a20f1467a015b0358b338b1d42484ac07004f8445bc2d

See more details on using hashes here.

Supported by

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