Skip to main content

Ormophine

A fast, Pythonic ORM that gets out of your way.

Python License Status PyPI

Write database queries the way you think — in plain Python.


The Problem with Other ORMs

Most Python ORMs are either too verbose, too magical, or too slow. Compare fetching filtered rows with a popular ORM versus Ormophine:

Other ORMs:

# SQLAlchemy (Core)
with engine.connect() as conn:
    stmt = select(users.c.phone, users.c.name, users.c.age).where(
        and_(
            users.c.age > 18,
            or_(
                users.c.phone.like('+98%'),
                func.substr(users.c.phone, 1, 3) == '+98'
            )
        )
    ).order_by(users.c.age)
    result = conn.execute(stmt).fetchall()

Ormophine:

from Ormophine.Sqlite import Driver

db = Driver('my_db.db')
users = db.users
phone, name, age = users.phone, users.name, users.age

users.get_row(
    [phone, name, age],
    where = (age > 18) & (phone.startswith('+98') | (phone[:3] == '+98')),
    order_by = age
)

Same result. No boilerplate. No imports for every logical operator. No ceremony.


Why Ormophine?

  • Intuitive syntax — columns behave like Python variables with full operator overloading (>, &, |, +, [], .startswith(), etc.)
  • Fast & Thread-Safe — built on a dedicated writer queue (SQLite) and robust connection pooling (MySQL/PostgreSQL); parallel reads, serialized writes.
  • Multi-database — one unified API across SQLite, MySQL, and PostgreSQL. Switch databases by changing your import.
  • Dynamic Schema Mapping — tables and columns are discovered automatically and attached to the driver instance.
  • WAL mode support (SQLite) — automatic checkpointing for maximum write throughput.
  • AI-Ready — includes backend-specific source code reference files to feed to LLMs like ChatGPT or Claude for instant, accurate ORM assistance.

Supported Databases

Database Status
SQLite ✅ Available
MySQL ✅ Available
PostgreSQL ✅ Available
MariaDB ✅ Available (via MySQL driver)

The API is identical across all backends. Switch databases by changing one line.


Video Tutorials

🎥 Coming Soon! We are preparing a comprehensive video series to help you get started with Ormophine, from basic connections to advanced concurrent read/write pooling and schema management.

Stay tuned—links will be posted here soon.


Benchmark Results

📊 Coming Soon! Benchmark results comparing Ormophine against SQLAlchemy, Tortoise ORM, and raw DB-API 2.0 will be published here. We are testing INSERT throughput, SELECT latency, bulk operations, and concurrent read workloads across all three backends.


Quick Examples

Connect and access tables

from Ormophine.Sqlite import Driver

db = Driver('company.db')

# Tables and columns are discovered automatically
users   = db.users
orders  = db.orders

Insert

users.insert({
    users.name:  'Alice',
    users.email: 'alice@example.com',
    users.age:   30
})

Select with conditions

name, email, age = users.name, users.email, users.age

rows = users.get_row(
    [name, email],
    where   = (age >= 18) & name.startswith('A'),
    order_by = age
)

Update

users.update(
    update = {users.age: users.age + 1},
    where  = users.status == 'active'
)

Bulk insert

users.bulk_insert(
    columns   = [users.name, users.age],
    data_list = [['Bob', 25], ['Carol', 32], ['Dave', 28]]
)

Joins

from Ormophine.Sqlite import Join

result = orders.join(
    columns    = [users.name, orders.amount, orders.date],
    joins_list = [Join.Inner(users, users.id == orders.user_id)],
    where      = orders.amount > 100,
    order_by   = [orders.date]
)

Schema management

from Ormophine.Sqlite import TableStructure, DataTypes

schema = TableStructure('products', strict=True)
schema.add_column('id',    DataTypes.INTEGER(), primary_key=True)
schema.add_column('title', DataTypes.TEXT(max_length=100), not_null=True, unique=True)
schema.add_column('price', DataTypes.REAL(), default_value=0.0)

products = db.create_table(schema)

# Add / rename / drop columns dynamically
products.add_column('stock', DataTypes.INTEGER(), default_value=0, not_null=True)
products.rename_column(products.stock, 'inventory')
products.delete_column(products.inventory, True, True, True)

WAL mode and performance tuning (SQLite)

db.set_WAL_mode(True, wal_timer=60)   # automatic checkpoint every 60 s

db.SetPragma.synchronous('NORMAL')
db.SetPragma.cache_size(-4000)        # 4 MiB page cache
db.SetPragma.foreign_keys(True)

Operator Reference

Ormophine columns support native Python expressions — all values are automatically parameterized to prevent SQL injection.

Expression SQL equivalent
age > 18 age > 18
(age >= 18) & (age < 65) age >= 18 AND age < 65
status == 'active' status = 'active'
name.startswith('A') name LIKE 'A%'
email.contains('@corp.com') email LIKE '%@corp.com%'
code[:3] SUBSTR(code, 1, 3)
name.upper().strip() TRIM(UPPER(name))
price * qty - discount price * qty - discount

AI-Powered Assistance

To help you write queries and debug your code, Ormophine ships with AI reference files (Sqlite.AI.Reference.txt, MySQL.AI.Reference.txt, PostgreSQL.AI.Reference.txt).

You can attach these files to ChatGPT, Claude, or Gemini, ask your question, and the AI will respond using the exact API and behavior of your Ormophine version.


Installation

pip install Ormophine

Roadmap

  • SQLite backend with full ORM
  • MySQL backend with connection pooling
  • PostgreSQL backend with connection pooling
  • Operator overloading for columns
  • Read-only connection pool / Non-blocking reads
  • WAL mode + automatic checkpointing
  • Batch / bulk operations
  • AI Reference files for LLM assistance
  • Video Tutorials
  • Benchmark suite publication
  • Async support

Contributing

The codebase is currently in active development. Contributions, bug reports, and feature requests are very welcome! Please feel free to open an issue or submit a pull request.


License

MIT — free to use, modify, and distribute.


Built with Python · Designed for developers who value clarity and speed

Release files for Ormophine 0.7.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Ormophine 0.7.12
File Size Uploaded
ormophine-0.7.12.tar.gz 569.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Ormophine 0.7.12
File Interpreter ABI Platform
ormophine-0.7.12-py3-none-any.whl Python 3 none any Details

Total release size: 1.2 MB

Release files / ormophine-0.7.12.tar.gz

Download URL ormophine-0.7.12.tar.gz
Size 569.9 kB
Tags Source
SHA-256 checksum
How to use checksums
93ecde8f48cd29cf84dae578691d268be7f96e4af4f17ea603bfd1069d935015
BLAKE2b-256 checksum
How to use checksums
6555a273f6772f6c0b52c8593e97e7573364cb0570831b56f80685d8ee633fe2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Release files / ormophine-0.7.12-py3-none-any.whl

Download URL ormophine-0.7.12-py3-none-any.whl
Size 595.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17fd8682e1c8ec0dee17ee05f8ef8c7f97cf7950293b59c940a9db16d4bb5a8f
BLAKE2b-256 checksum
How to use checksums
7babb271634c8b31139534213af3f134e23441cf561a8c003470faa0d3ef7f50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Release history Release notifications | RSS feed

0.12.5

2 release files

0.12.4

2 release files

0.12.3

2 release files

0.12.2

2 release files

0.12.1

2 release files

0.11.4

2 release files

0.11.3

2 release files

0.11.2

2 release files

0.11.1

2 release files

0.10.8

2 release files

0.10.6

2 release files

0.10.5

2 release files

0.10.4

2 release files

0.10.3

2 release files

0.10.1

2 release files

0.9.7

2 release files

0.9.6

2 release files

0.9.5

2 release files

0.9.4

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.8.13

2 release files

0.8.11

2 release files

0.8.10

2 release files

0.8.9

2 release files

0.8.8

2 release files

0.8.7

2 release files

0.8.6

2 release files

0.8.5

2 release files

0.8.4

2 release files

0.8.2

2 release files

0.8.0

2 release files

0.7.28

2 release files

0.7.26

2 release files

This release

0.7.12 This release

2 release files

0.7.9

2 release files

0.7.8

2 release files

0.7.7

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page