Skip to main content

A small example package

Project description

██╗  ██╗██╗  ██╗███╗   ███╗███████╗██████╗ ██╗
██║ ██╔╝██║  ██║████╗ ████║██╔════╝██╔══██╗██║
█████╔╝ ███████║██╔████╔██║█████╗  ██████╔╝██║
██╔═██╗ ██╔══██║██║╚██╔╝██║██╔══╝  ██╔══██╗██║
██║  ██╗██║  ██║██║ ╚═╝ ██║███████╗██║  ██║██║
╚═╝  ╚═╝╚═╝  ╚═╝╚═╝     ╚═╝╚══════╝╚═╝  ╚═╝╚═╝

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

khmeri-0.0.1.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

khmeri-0.0.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file khmeri-0.0.1.tar.gz.

File metadata

  • Download URL: khmeri-0.0.1.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for khmeri-0.0.1.tar.gz
Algorithm Hash digest
SHA256 d3847beaa66f46659f3d6afe79110f44468486ebb5dd27d89f510ffc2ed302da
MD5 8146befcb60eb06ef4fd5fd20792f655
BLAKE2b-256 3bd15063e10f5c236b1d981e031952281174bca806cc1ff54ae7b3b20a16368e

See more details on using hashes here.

File details

Details for the file khmeri-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: khmeri-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for khmeri-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4e6142d8289a9d64c672667185424015640a7e8f98b5c801856b0c186b7bf730
MD5 d44ad0710ae92d5de84df99c5e676009
BLAKE2b-256 95d72c6b906eaeb35ba47c19802f5211be995294a2326bb646c0a7237f5b7263

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page