is a Simple, FileBase and Document Oriented database
Project description
Introduction
PantherDB is a Simple, FileBase and Document Oriented database that you can use it in your projects.
Features:
- Document Oriented
- Easy to use
- Written in pure Python +3.11 based on standard type hints
- 85% Test coverage
Usage
Database:
-
Create database:
db: PantherDB = PantherDB('database.json')
-
Access to a collection:
user_collection: PantherCollection = db.collection('User')
-
Delete a collection:
db.collection('User').drop()
Create:
-
Insert document:
user: PantherDocument = db.collection('User').insert_one(first_name='Ali', last_name='Rn')
Get:
-
Find first document:
user: PantherDocument = db.collection('User').first(first_name='Ali', last_name='Rn')
or
user: PantherDocument = db.collection('User').first()
-
Find last document:
user: PantherDocument = db.collection('User').last(last_name='Rn')
or
user: PantherDocument = db.collection('User').last()
-
Find documents:
user: PantherDocument = db.collection('User').find(last_name='Rn')
-
All documents:
users: list[PantherDocument] = db.collection('User').all()
-
Count documents:
users_count: int = db.collection('User').count(first_name='Ali')
Update:
-
Update documents:
user: PantherDocument = db.collection('User').get(first_name='Ali', last_name='Rn') user.update(name='Saba')
-
Find and Update one:
_filter = {'first_name': 'Ali', 'last_name': 'Rn'} is_updated: bool = db.collection('User').update_one(_filter, first_name='Saba')
-
Filter and Update many:
_filter = {'first_name': 'Ali'} updated_count: int = db.collection('User').update_many(_filter, first_name='Saba')
Delete:
-
Delete documents:
user: PantherDocument = db.collection('User').first(first_name='Ali', last_name='Rn') user.delete()
-
Filter and Delete documents:
is_deleted: bool = db.collection('User').delete_one(first_name='Ali', last_name='Rn')
-
Filter and Delete many:
deleted_count: int = db.collection('User').delete_many(last_name='Rn')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pantherdb-1.1.1.tar.gz
(3.9 kB
view hashes)
Built Distribution
Close
Hashes for pantherdb-1.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0eac95657221bcf0d9a44889f12462dabc5809d1cc182b098b301b57cf66a477 |
|
MD5 | cc70ec7b465b23ee3e4131e4e4dae8b0 |
|
BLAKE2b-256 | 3a6281897caf5f715b56e69ed1b4224f69fa78c7e3bb34219ac30c741862e67f |