Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoSQL database support #96

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added omniduct/nosql/__init__.py
Empty file.
40 changes: 40 additions & 0 deletions omniduct/nosql/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from interface_meta import quirk_docs

from omniduct.duct import Duct


class NoSqlClient(Duct):
"""
A simple generic NoSQL database client, providing a minimal common API across
NoSQL databases. Subclasses can extend this functionality either by exposing
another python client directly, or by adding additional methods as needed.
"""

DUCT_TYPE = Duct.Type.NOSQL

@quirk_docs('_init')
def __init__(self, server_protocol='http', assume_json=False, endpoint_prefix='', **kwargs):
"""
This is a shim __init__ function that passes all arguments onto
`self._init`, which is implemented by subclasses. This allows subclasses
to instantiate themselves with arbitrary parameters.
"""
Duct.__init_with_kwargs__(self, kwargs, port=80)

self.server_protocol = server_protocol
self.assume_json = assume_json
self.endpoint_prefix = endpoint_prefix

self._init(**kwargs)

def _init(self):
pass

def get(self):
pass

def put(self):
pass

def find(self):
pass