Kongodb
Kongodb is Hybrid Row-and-Document Oriented datastore leveraging SQL/RDBMS database: SQLite, MySQL, MariaDB, Postgresql
Kongodb is both RDMBS + Document Oriented together.
It supports, regular SQL query along with Document Oriented and Key Value store.
Engine:
- SQLite
- Mariadb
- PostgreSQL
- MySQL
Install
pip install kongodb
Usage
from kongodb import kongodb
# Open the db
db = kongodb("./my.db")
# Select a collection
# Collection will be created automatically
collection = db.collection("test")
# Get total items
print(len(collection))
# Add an item. It returns kongodb#Item
item = collection.add({
"name": "Kongo",
"type": "DB",
"version": "1.0.0"
})
# Retrieve item by _id
_id = "9c5e5fbd05544700995c5fa3ca3ef214"
item = collection.get(_id)
# Access properties
item.get("name") # -> fun
item.get("type") # -> DB
all_item_data = dict(item)
# Update a field
item.set("version", "1.0.1")
# or advance atomic update
item.update({
"version": "1.0.1",
"download:$inc": True,
"ips:$xadd": "0.0.0.0"
})
#
item.get("version") # -> 1.0.1
item.get("download") # -> 1 or last value + 1
item.get("ips") # -> ["0.0.0.0"]
# Delete item
item.delete()
# Search
for item in collection.find():
print(item.get("name"))
~ API ~
Database
kongodb
#collection
To select a collection in the database
from kongodb import kongodb
db = kongodb()
users = fun.collection("users")
# all users
all_users = users.find_all()
#Collection
List all the collections in the database
from kongodb import kongodb
db = kongodb()
users = fun.collection("users")
ColumnTypes For Index:
| Type | Column | SQlite | MariaDB | PostgreSQL |
|---|---|---|---|---|
| Integer | IntegerType | INT | INTEGER | INT |
| String | StringType | VARCHAR(n) | VARCHAR(n) | VARCHAR(n) |
| Bool | BoolType | INT(1) | TINYINT(1) | BOOLEAN |
| Datetime | DatetimeType | TIMESTAMP | DATETIME | TIMESTAMP |
| Numeric | NumericType | FLOAT | DOUBLE PRECISION | DOUBLE PRECISION |
*n = the max number for the char
ColumnType
types.[columtype](
name:str, # str: name of the field
length:int, # int: length of the type if available
index:bool, # bool: to index the field
unique:bool, # bool: to index and make field unique
default:Any # Any: any data to set as default
)
ie:
Example
types.StringType(
name="myFieldName",
length=125,
index=True,
unique=True,
default="Hello"
)
Add Columns
from kongodb import kongodb, types
COLUMNS = [
types.IntegerType('count', index=True, default=0),
types.BoolType('is_active', default=True),
types.Datetime('created_at', default="NOW()"),
types.String('full_name'),
types.NumericType('amount', default=0.00)
]
db = kongodb("sqlite://")
collection = db.collection('test', columns=COLUMNS)
Metadata
Release files for kongodb 0.0.20
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kongodb-0.0.20.tar.gz | 24.1 kB | Without provenance | Details for kongodb-0.0.20.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kongodb-0.0.20-py3-none-any.whl | Python 3 | none | any | Details for kongodb-0.0.20-py3-none-any.whl |
Total release size: 49.2 kB
Release files / kongodb-0.0.20.tar.gz
| Download URL | kongodb-0.0.20.tar.gz |
|---|---|
| Size | 24.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6aa74d11223a3810d1c5f7023f8a98cde67f32f710228a8a49e9bb7a19dd12b3
|
|
BLAKE2b-256 checksum How to use checksums |
e50872c3b31f2a7cfecf712d8b8ea75ac4ecb701fb4866cf8f6d10638abe86f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.8.10
|
Release files / kongodb-0.0.20-py3-none-any.whl
| Download URL | kongodb-0.0.20-py3-none-any.whl |
|---|---|
| Size | 25.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e26a40d528cb7c49991eedbc720f1a745fc75bcae7c0d6451cd3e32e498ec0ad
|
|
BLAKE2b-256 checksum How to use checksums |
a0c64377c115e2d89cace41a13a6a6f70762d16820b68dd06efc00542dd3dca4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.8.10
|
Security for kongodb 0.0.20
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.