Skip to main content

A tiny documents database for Python

Project description

Shelf DB

Introduction

Shelf DB is a tiny document database for Python to stores documents or JSON-like data.

Get it

$ pip install shelfdb shelfquery

Start asyncio server

$ shelfdb
Serving on ('127.0.0.1', 17000)
Database : db
pid : 12359

uvloop built-in already to make it faster. See uvloop.

Sync/Async query client through network.

import shelfquery

# Sync client point to 127.0.0.1:17000
db = shelfquery.db()

# Make it async client
db.asyncio()

# Make it sync client again
db.sync()

Store data

db.shelf('note').insert({
    'title': 'Shelf DB',
    'content': 'Simple note',
    'datetime': datetime.utcnow()})

Flexible query API with similar syntax

db.shelf('note')\
    .filter(lambda note:
        note['title'] == 'Shelf DB')\
    .sort(key=lambda note: note['datetime'])
    .run()

No need to learn more syntax. Let's just query using filter, slice, sort, map, reduce which almost the same to Python built-in functions.

Regular expression

Python reqular expression re can be use inside query function

import re
db.shelf('note')\
    .filter(lambda note:
        re.match(r'.*DB$', note['title']))\
    .run()

Tiny

shelfdb ~ 12kB shelfquery ~ 4kB

Runtime code is small, easy to install. Shelf DB also works on Raspberry Pi.

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

shelfdb-1.0.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

shelfdb-1.0.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file shelfdb-1.0.0.tar.gz.

File metadata

  • Download URL: shelfdb-1.0.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for shelfdb-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b7a09432bc56f841765ab753cc7306475b291bdff99307086e0e1b04219cf741
MD5 5c7e190d639cb77921f99f225486fd6a
BLAKE2b-256 4cb613cf0c77bdea6eb6fa5639a5c0fd4791b2a221641b270f881c8933bbaccc

See more details on using hashes here.

File details

Details for the file shelfdb-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: shelfdb-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for shelfdb-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c5c2805997d53c2e1a950a4855086f52237e9f9c5b42b6f3bd610c7f4b31e63
MD5 0a3108d122cdf08ff24db6ce86c01045
BLAKE2b-256 f659b7b03dbe709cada5a6f81bc7492bf92ef54c024d6092d72f318c490fd144

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