██╗ ██╗██╗ ██╗███╗ ███╗███████╗██████╗ ██╗ ██║ ██╔╝██║ ██║████╗ ████║██╔════╝██╔══██╗██║ █████╔╝ ███████║██╔████╔██║█████╗ ██████╔╝██║ ██╔═██╗ ██╔══██║██║╚██╔╝██║██╔══╝ ██╔══██╗██║ ██║ ██╗██║ ██║██║ ╚═╝ ██║███████╗██║ ██║██║ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═╝
Khmeri is a lightweight ORM for SQLite3 written in Python
Installation
The ORM can be installed through the Python Package Index with the commmand:
pip install khmeri
Usage
If you have ever used another ORM, such as Django's ORM, you will see that the syntax is almost the same, with Khmeri focusing on being lightweight and having simple syntax, for quick writing of models in small to medium-sized databases.
Let's define a model as an example:
import khmeri
class object_one(khmeri.Model):
id = khmeri.Int(primary_key=True) # auto-increment
task = khmeri.Str()
interval = khmeri.Int()
now, we need to connect to a SQLite3 database:
db = khmeri.Database('sample_database.db')
To perform basic CRUD operations, set the database as the backend of your object:
object_one.objects.backend = db
Instance Attributes
The following instance attributes can be applied to each module:
Database
- connected
- cursor
- connection
- connect()
- close()
- select(sql, *args, size=None)
- execute(sql, *args, autocommit=True)
- commit()
Str
- name
- type
- default
- primary_key
Int
- name
- type
- default
- primary_key
Float
- name
- type
- default
- primary_key
Model
- __table__
- __mappings__
- __fields__
- __primary_key__
- objects
- exists()
- create()
- drop()
- save()
- update()
- delete()
- keys(), values(), items(), copy() and other methods imported from dict
Contributing
This project is still very much in its infant stage and any help is appreciated. The next steps I would like to take would be implementing tests to evaluate how reliable the ORM is and then updating the models to handle more complex tasks than simple CRUD operations. You can open an issue or PR and I will make sure to see to it promptly.
Metadata
Release files for khmeri 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| khmeri-0.0.1.tar.gz | 6.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| khmeri-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.6 kB
Release files / khmeri-0.0.1.tar.gz
| Download URL | khmeri-0.0.1.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d3847beaa66f46659f3d6afe79110f44468486ebb5dd27d89f510ffc2ed302da
|
|
BLAKE2b-256 checksum How to use checksums |
3bd15063e10f5c236b1d981e031952281174bca806cc1ff54ae7b3b20a16368e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Release files / khmeri-0.0.1-py3-none-any.whl
| Download URL | khmeri-0.0.1-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4e6142d8289a9d64c672667185424015640a7e8f98b5c801856b0c186b7bf730
|
|
BLAKE2b-256 checksum How to use checksums |
95d72c6b906eaeb35ba47c19802f5211be995294a2326bb646c0a7237f5b7263
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|