shelfdb


Nameshelfdb JSON
Version 1.1.1 PyPI version JSON
download
home_pagehttps://github.com/nitipit/shelfdb
SummaryA tiny documents database for Python
upload_time2023-03-24 02:46:46
maintainer
docs_urlNone
authorNitipit Nontasuwan
requires_python>=3.10.0
license
keywords dict json database
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Shelf DB
<img src="https://raw.githubusercontent.com/nitipit/shelfdb/master/docs/shelf.png" style="max-width: 400px;">

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

## Get it
```shell
$ pip install shelfdb shelfquery
```

## Start asyncio server
```shell
$ shelfdb
Serving on ('127.0.0.1', 17000)
Database : db
pid : 12359
```

> <bits-tag>uvloop</bits-tag> built-in already to make it faster. See [uvloop](https://github.com/MagicStack/uvloop).

## Sync/Async query client through network.
```python
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
```python
db.shelf('note').insert({
    'title': 'Shelf DB',
    'content': 'Simple note',
    'datetime': datetime.utcnow()})
```

## Flexible query API with similar syntax
```python
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
```python
import re
db.shelf('note')\
    .filter(lambda note:
        re.match(r'.*DB$', note['title']))\
    .run()
```

<h2 style="display: inline-block; width: auto; margin-bottom: 0;">Tiny</h2>
<span style="vertical-align: text-bottom;">
    <bits-tag class="bg-c">shelfdb ~ 12kB</bits-tag>
    <bits-tag class="bg-c">shelfquery ~ 4kB</bits-tag>
</span>

Runtime code is small, easy to install. <bits-tag>Shelf DB</bits-tag> also works on **Raspberry Pi**.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/nitipit/shelfdb",
    "name": "shelfdb",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10.0",
    "maintainer_email": "",
    "keywords": "dict,json,database",
    "author": "Nitipit Nontasuwan",
    "author_email": "nitipit@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/83/45/7936ea18339cf5250b9ff0e4930278b68923110d80ddd111a4785647d734/shelfdb-1.1.1.tar.gz",
    "platform": null,
    "description": "# Shelf DB\n<img src=\"https://raw.githubusercontent.com/nitipit/shelfdb/master/docs/shelf.png\" style=\"max-width: 400px;\">\n\n## Introduction\n**Shelf DB** is a tiny document database for Python to stores **documents** or **JSON**-like data.\n\n## Get it\n```shell\n$ pip install shelfdb shelfquery\n```\n\n## Start asyncio server\n```shell\n$ shelfdb\nServing on ('127.0.0.1', 17000)\nDatabase : db\npid : 12359\n```\n\n> <bits-tag>uvloop</bits-tag> built-in already to make it faster. See [uvloop](https://github.com/MagicStack/uvloop).\n\n## Sync/Async query client through network.\n```python\nimport shelfquery\n\n# Sync client point to 127.0.0.1:17000\ndb = shelfquery.db()\n\n# Make it async client\ndb.asyncio()\n\n# Make it sync client again\ndb.sync()\n```\n\n## Store data\n```python\ndb.shelf('note').insert({\n    'title': 'Shelf DB',\n    'content': 'Simple note',\n    'datetime': datetime.utcnow()})\n```\n\n## Flexible query API with similar syntax\n```python\ndb.shelf('note')\\\n    .filter(lambda note:\n        note['title'] == 'Shelf DB')\\\n    .sort(key=lambda note: note['datetime'])\n    .run()\n```\nNo need to learn more syntax. Let's just query using `filter`, `slice`, `sort`, `map`, `reduce` which almost the same to Python built-in functions.\n\n## Regular expression\nPython reqular expression `re` can be use inside query function\n```python\nimport re\ndb.shelf('note')\\\n    .filter(lambda note:\n        re.match(r'.*DB$', note['title']))\\\n    .run()\n```\n\n<h2 style=\"display: inline-block; width: auto; margin-bottom: 0;\">Tiny</h2>\n<span style=\"vertical-align: text-bottom;\">\n    <bits-tag class=\"bg-c\">shelfdb ~ 12kB</bits-tag>\n    <bits-tag class=\"bg-c\">shelfquery ~ 4kB</bits-tag>\n</span>\n\nRuntime code is small, easy to install. <bits-tag>Shelf DB</bits-tag> also works on **Raspberry Pi**.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A tiny documents database for Python",
    "version": "1.1.1",
    "split_keywords": [
        "dict",
        "json",
        "database"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bb55c75858df26e7f114e036acca6f4239c41841597e546d77de9909cddb53b9",
                "md5": "acc996f07545994ad23f99d693254716",
                "sha256": "99ab06fb4750c78514f8c73a4bea45d9117d5a5a281580bd3b166f1eb5b681a3"
            },
            "downloads": -1,
            "filename": "shelfdb-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "acc996f07545994ad23f99d693254716",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10.0",
            "size": 10147,
            "upload_time": "2023-03-24T02:46:43",
            "upload_time_iso_8601": "2023-03-24T02:46:43.908934Z",
            "url": "https://files.pythonhosted.org/packages/bb/55/c75858df26e7f114e036acca6f4239c41841597e546d77de9909cddb53b9/shelfdb-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "83457936ea18339cf5250b9ff0e4930278b68923110d80ddd111a4785647d734",
                "md5": "cadf02e18d0cea830caf19d2b47ccc88",
                "sha256": "84b2c0ce252ee9f6df0f9af3f53d406c7743127fc9f26f41bb218403fae9f55a"
            },
            "downloads": -1,
            "filename": "shelfdb-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "cadf02e18d0cea830caf19d2b47ccc88",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10.0",
            "size": 9672,
            "upload_time": "2023-03-24T02:46:46",
            "upload_time_iso_8601": "2023-03-24T02:46:46.814594Z",
            "url": "https://files.pythonhosted.org/packages/83/45/7936ea18339cf5250b9ff0e4930278b68923110d80ddd111a4785647d734/shelfdb-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-24 02:46:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "nitipit",
    "github_project": "shelfdb",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "shelfdb"
}
        
Elapsed time: 0.05515s