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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for shelfdb-1.1.1.tar.gz
Algorithm Hash digest
SHA256 84b2c0ce252ee9f6df0f9af3f53d406c7743127fc9f26f41bb218403fae9f55a
MD5 cadf02e18d0cea830caf19d2b47ccc88
BLAKE2b-256 83457936ea18339cf5250b9ff0e4930278b68923110d80ddd111a4785647d734

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for shelfdb-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 99ab06fb4750c78514f8c73a4bea45d9117d5a5a281580bd3b166f1eb5b681a3
MD5 acc996f07545994ad23f99d693254716
BLAKE2b-256 bb55c75858df26e7f114e036acca6f4239c41841597e546d77de9909cddb53b9

See more details on using hashes here.

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