pantherdb


Namepantherdb JSON
Version 2.1.0 PyPI version JSON
download
home_pagehttps://github.com/PantherPy/pantherdb
Summaryis a Simple, FileBase and Document Oriented database
upload_time2024-03-24 19:51:10
maintainerNone
docs_urlNone
authorAli RajabNezhad
requires_python>=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
[![PyPI](https://img.shields.io/pypi/v/pantherdb?label=PyPI)](https://pypi.org/project/pantherdb/) [![PyVersion](https://img.shields.io/pypi/pyversions/pantherdb.svg)](https://pypi.org/project/pantherdb/) [![Downloads](https://static.pepy.tech/badge/pantherdb/month)](https://pepy.tech/project/pantherdb) [![license](https://img.shields.io/github/license/alirn76/pantherdb.svg)](https://github.com/alirn76/pantherdb/blob/main/LICENSE)

## Introduction

PantherDB is a <b>Simple</b>, <b>FileBase</b> and <b>Document Oriented</b> database that you can use in your projects.

### Features:
- Document Oriented
- Easy to use
- Written in pure Python +3.8 based on standard type hints
- Handle Database Encryption
- Singleton connection per `db_name`

## Usage

### Database:
- #### Create a database:
    ```python
    db: PantherDB = PantherDB('database.pdb')
    ```
  
- #### Create an encrypted database:
    Required `cyptography` install it with `pip install pantherdb[full]`
    ```python
    from cryptography.fernet import Fernet
    key = Fernet.generate_key()  # Should be static (You should not generate new key on every run)
    db: PantherDB = PantherDB('database.pdb', secret_key=key)
    ```

- #### Access to a collection:
    ```python
    user_collection: PantherCollection = db.collection('User')
    ```

- #### Delete a collection:
    ```python
    db.collection('User').drop()
    ```
### Create:
- #### Insert document:
    ```python
    user: PantherDocument = db.collection('User').insert_one(first_name='Ali', last_name='Rn')
    ```

### Get:
- #### Find one document:
    ```python
    user: PantherDocument = db.collection('User').find_one(first_name='Ali', last_name='Rn')
    ```
    or
    ```python
    user: PantherDocument = db.collection('User').find_one()
    ```
  
- #### Find first document (alias of `find_one()`):
    ```python
    user: PantherDocument = db.collection('User').first(first_name='Ali', last_name='Rn')
    ```
    or
    ```python
    user: PantherDocument = db.collection('User').first()
    ```
  
- #### Find last document:
    ```python
    user: PantherDocument = db.collection('User').last(first_name='Ali', last_name='Rn')
    ```
    or
    ```python
    user: PantherDocument = db.collection('User').last()
    ```
  
- #### Find documents:
    ```python
    users: list[PantherDocument] = db.collection('User').find(last_name='Rn')
    ```
    or all documents
    ```python
    users: list[PantherDocument] = db.collection('User').find()
    ```

- #### Count documents:
    ```python
    users_count: int = db.collection('User').count(first_name='Ali')
    ```

### Update:
- #### Update a document:
  ```python
  user: PantherDocument = db.collection('User').find_one(first_name='Ali', last_name='Rn')
  user.update(name='Saba')
  ```

- #### Filter and Update a document:
  ```python
  _filter = {'first_name': 'Ali', 'last_name': 'Rn'}
  is_updated: bool = db.collection('User').update_one(_filter, first_name='Saba')
  ```

- #### Filter and Update many:
  ```python
  _filter = {'first_name': 'Ali'}
  updated_count: int = db.collection('User').update_many(_filter, first_name='Saba')
  ```
  
### Delete:
- #### Delete a document:
  ```python
  user: PantherDocument = db.collection('User').first(first_name='Ali', last_name='Rn')
  user.delete()
  ```

- #### Filter and Delete a document:
  ```python
  is_deleted: bool = db.collection('User').delete_one(first_name='Ali', last_name='Rn')
  ```

- #### Filter and Delete many:
  ```python
  deleted_count: int = db.collection('User').delete_many(last_name='Rn')
  ```
  
## TODO:
- [x] Add encryption
- [ ] Complete tests TODO
- [ ] Add B+ tree

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/PantherPy/pantherdb",
    "name": "pantherdb",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Ali RajabNezhad",
    "author_email": "alirn76@yahoo.com",
    "download_url": "https://files.pythonhosted.org/packages/cc/a4/c9f14cf158dc0e46798db013547b95d761d1f9f270aca769ab18fbb613e0/pantherdb-2.1.0.tar.gz",
    "platform": null,
    "description": "\n[![PyPI](https://img.shields.io/pypi/v/pantherdb?label=PyPI)](https://pypi.org/project/pantherdb/) [![PyVersion](https://img.shields.io/pypi/pyversions/pantherdb.svg)](https://pypi.org/project/pantherdb/) [![Downloads](https://static.pepy.tech/badge/pantherdb/month)](https://pepy.tech/project/pantherdb) [![license](https://img.shields.io/github/license/alirn76/pantherdb.svg)](https://github.com/alirn76/pantherdb/blob/main/LICENSE)\n\n## Introduction\n\nPantherDB is a <b>Simple</b>, <b>FileBase</b> and <b>Document Oriented</b> database that you can use in your projects.\n\n### Features:\n- Document Oriented\n- Easy to use\n- Written in pure Python +3.8 based on standard type hints\n- Handle Database Encryption\n- Singleton connection per `db_name`\n\n## Usage\n\n### Database:\n- #### Create a database:\n    ```python\n    db: PantherDB = PantherDB('database.pdb')\n    ```\n  \n- #### Create an encrypted database:\n    Required `cyptography` install it with `pip install pantherdb[full]`\n    ```python\n    from cryptography.fernet import Fernet\n    key = Fernet.generate_key()  # Should be static (You should not generate new key on every run)\n    db: PantherDB = PantherDB('database.pdb', secret_key=key)\n    ```\n\n- #### Access to a collection:\n    ```python\n    user_collection: PantherCollection = db.collection('User')\n    ```\n\n- #### Delete a collection:\n    ```python\n    db.collection('User').drop()\n    ```\n### Create:\n- #### Insert document:\n    ```python\n    user: PantherDocument = db.collection('User').insert_one(first_name='Ali', last_name='Rn')\n    ```\n\n### Get:\n- #### Find one document:\n    ```python\n    user: PantherDocument = db.collection('User').find_one(first_name='Ali', last_name='Rn')\n    ```\n    or\n    ```python\n    user: PantherDocument = db.collection('User').find_one()\n    ```\n  \n- #### Find first document (alias of `find_one()`):\n    ```python\n    user: PantherDocument = db.collection('User').first(first_name='Ali', last_name='Rn')\n    ```\n    or\n    ```python\n    user: PantherDocument = db.collection('User').first()\n    ```\n  \n- #### Find last document:\n    ```python\n    user: PantherDocument = db.collection('User').last(first_name='Ali', last_name='Rn')\n    ```\n    or\n    ```python\n    user: PantherDocument = db.collection('User').last()\n    ```\n  \n- #### Find documents:\n    ```python\n    users: list[PantherDocument] = db.collection('User').find(last_name='Rn')\n    ```\n    or all documents\n    ```python\n    users: list[PantherDocument] = db.collection('User').find()\n    ```\n\n- #### Count documents:\n    ```python\n    users_count: int = db.collection('User').count(first_name='Ali')\n    ```\n\n### Update:\n- #### Update a document:\n  ```python\n  user: PantherDocument = db.collection('User').find_one(first_name='Ali', last_name='Rn')\n  user.update(name='Saba')\n  ```\n\n- #### Filter and Update a document:\n  ```python\n  _filter = {'first_name': 'Ali', 'last_name': 'Rn'}\n  is_updated: bool = db.collection('User').update_one(_filter, first_name='Saba')\n  ```\n\n- #### Filter and Update many:\n  ```python\n  _filter = {'first_name': 'Ali'}\n  updated_count: int = db.collection('User').update_many(_filter, first_name='Saba')\n  ```\n  \n### Delete:\n- #### Delete a document:\n  ```python\n  user: PantherDocument = db.collection('User').first(first_name='Ali', last_name='Rn')\n  user.delete()\n  ```\n\n- #### Filter and Delete a document:\n  ```python\n  is_deleted: bool = db.collection('User').delete_one(first_name='Ali', last_name='Rn')\n  ```\n\n- #### Filter and Delete many:\n  ```python\n  deleted_count: int = db.collection('User').delete_many(last_name='Rn')\n  ```\n  \n## TODO:\n- [x] Add encryption\n- [ ] Complete tests TODO\n- [ ] Add B+ tree\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "is a Simple, FileBase and Document Oriented database",
    "version": "2.1.0",
    "project_urls": {
        "Homepage": "https://github.com/PantherPy/pantherdb"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ca1ac2f5781a6a52fb88e3078e8ce207de5adcad31973ee1f184de1c4ddf57a2",
                "md5": "51720cca21a29b3fbc29073aba7445ac",
                "sha256": "081d30b8c4ff7a7eb0af38bbbac06e753cf67146ddde906a57e4ecc631ff434c"
            },
            "downloads": -1,
            "filename": "pantherdb-2.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "51720cca21a29b3fbc29073aba7445ac",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 7175,
            "upload_time": "2024-03-24T19:51:08",
            "upload_time_iso_8601": "2024-03-24T19:51:08.394144Z",
            "url": "https://files.pythonhosted.org/packages/ca/1a/c2f5781a6a52fb88e3078e8ce207de5adcad31973ee1f184de1c4ddf57a2/pantherdb-2.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cca4c9f14cf158dc0e46798db013547b95d761d1f9f270aca769ab18fbb613e0",
                "md5": "39c2af60719393d2474da81a577025ae",
                "sha256": "7e42437080c7e85dc59f886655a24fbee2b22c498248cc77953a8e057d2c956c"
            },
            "downloads": -1,
            "filename": "pantherdb-2.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "39c2af60719393d2474da81a577025ae",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 9505,
            "upload_time": "2024-03-24T19:51:10",
            "upload_time_iso_8601": "2024-03-24T19:51:10.141095Z",
            "url": "https://files.pythonhosted.org/packages/cc/a4/c9f14cf158dc0e46798db013547b95d761d1f9f270aca769ab18fbb613e0/pantherdb-2.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-24 19:51:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "PantherPy",
    "github_project": "pantherdb",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pantherdb"
}
        
Elapsed time: 0.21429s