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.1.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

shelfdb-1.1.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: shelfdb-1.1.0.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for shelfdb-1.1.0.tar.gz
Algorithm Hash digest
SHA256 57a9691732368bb25ecef7c0cb83415f8b1eb71520c2642ca4e09ac71001217c
MD5 f6a1da9253851b577a725e59d47a5c14
BLAKE2b-256 583fee3f1ebb119dd5289d47ebeb7f02071c6a41b56451c15e979579e45d9009

See more details on using hashes here.

File details

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

File metadata

  • Download URL: shelfdb-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for shelfdb-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 88c50ac1859dc485d8eae2990cfcbaffade12c910ca954e23453a9ac33e8a400
MD5 221923c8e1748fe977d14c038830c37c
BLAKE2b-256 45917f707353c7a8e07401e589265c21bca784a8825140de21a1f1517dd3050c

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