Skip to main content

a ORM model for AWS QLDB

Project description

makpar-innovation-laboratory

innoldb

A simple Object-Relation-Mapping for a serverless AWS Quantum Ledger Database backend, and a command line utility for querying tables on those ledgers.

NOTE: The user or process using this library must have an IAM policy that allows access to QLDB.

ORM

The idea behind the ORM is to map document fields to native Python object attributes, so that document values can be accessed by traversing the object property tree.

CRUD OPERATIONS

from innoldb.qldb import Document

# Create a document on `my_table` table.
document = Document('my_table')
document.field = {
  'nested_data': {
    'array': ['colllection', 'of', 'things']
  }
}
document.save()
from innoldb.qldb import Document

# Load a document from `my_table` table.
document = Document('my_table', id="123456")
for val in document.field.nested_data.array:
  print(val)

Queries

from innoldb.qldb import Query

query = Query('my-table').find_by(field_name='field value')
for document in query:
  print(f'Document({document.id}).field_name = {document.field_name}')

CLI

CRUD Operations

innoldb --table your-table --insert col1=val1 col2=val2 ...
innoldb --table your-table --id 123 --update col1=newval1 col2=newval2

Queries

innoldb --table your-table --find column=this

Read The Docs

Code Quality

DeepSource DeepSource

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

innoldb-1.0.15.tar.gz (25.1 kB view hashes)

Uploaded Source

Built Distribution

innoldb-1.0.15-py3-none-any.whl (26.2 kB view hashes)

Uploaded Python 3

Supported by

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