Ormlet is a lightweight, minimal ORM designed to give you just enough structure and flexibility to build SQL queries.
The key features are:
- Declarative column definitions (IntegerField, TextField, etc.)
- Auto SQL generation for SELECT, INSERT, UPDATE, DELETE
- Fluent and chainable QueryBuilder
- Logical operators: AND, OR, multiple WHERE support
Installation
Create and activate a virtual environment and then install Ormlet:
$ pip install ormlet
---> 100%
Successfully installed ormlet
Example
Models
from ormlet import Model, column
class User(Model):
__table__ = "users"
id = column.IntegerField(primary_key=True, autoincrement=True)
name = column.VarCharField(max_length=50)
age = column.IntegerField()
Database Manager
from ormlet import DatabaseManager
db = DatabaseManager("test.db")
db.register_tables([User])
Queries
from ormlet import insert, select, update, delete
insert(User).values(id=1, name="Alice", age=30).execute(connection)
select(User).where(User.name == "Bob").execute(connection)
update(User).set(age=41).where(User.name == "Charlie").execute(connection)
delete(User).where(User.name == "Dan").execute(connection)
Quick Example
from ormlet import DatabaseManager, Model, column
class User(Model):
__table__ = "users"
id = column.IntegerField(primary_key=True)
name = column.VarCharField(max_length=50)
age = column.IntegerField()
db = DatabaseManager("test.db")
db.register_tables([User])
with db.connect() as conn:
insert(User).values(id=1, name="Alice", age=30).execute(conn)
select(User).where(User.name == "Alice").execute(conn)
update(User).set(age=41).where(User.name == "Alice").execute(conn)
delete(User).where(User.id== 1).execute(conn)
Dependencies
Ormlet uses no external dependencies it works with just standard Python.
License
This project is licensed under the terms of the MIT license.
Contributing
Feel free to open issues, suggest features, or submit PRs.
Metadata
Release files for ormlet 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ormlet-0.1.0.tar.gz | 6.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ormlet-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.8 kB
Release files / ormlet-0.1.0.tar.gz
| Download URL | ormlet-0.1.0.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b3e2eecb4fff8d56acde4047eab6a960e2d239be402721e761417286bad36de
|
|
BLAKE2b-256 checksum How to use checksums |
ac909ead8659878a076cf638c669b0bcb2c8a329e36270f79f1b1d835e539600
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Release files / ormlet-0.1.0-py3-none-any.whl
| Download URL | ormlet-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1fbb0d811073584bc94e6f954208160639ff15bc275a8f7a92a054fab2c962b0
|
|
BLAKE2b-256 checksum How to use checksums |
ebb244c282c32023445a5c614f86f2e9950e954a68e44fb482ca0dd1ee1cf98e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|