Skip to main content

halfORM

PyPI version Python versions PostgreSQL versions License Tests Coverage Downloads

⚠️ BREAKING CHANGE in v0.18 — psycopg2 → psycopg 3

halfORM 0.18 drops psycopg2 and requires psycopg 3.

pip uninstall psycopg2-binary
pip install "psycopg[binary]"

If you use custom psycopg2 adapters in your own code, rewrite them with the psycopg 3 Dumper/Loader API. See the full migration notes in CHANGELOG.md.

psycopg2 users: the 0.17.x branch is maintained for psycopg2 and receives bug fixes.

halfORM is a database-first ORM for PostgreSQL. You write the schema in SQL; halfORM introspects it at runtime and gives you Python objects to work with your data. No migrations, no code generation.

The central idea: a Relation object is a predicate. It describes the logical condition that rows must satisfy to belong to the relation. Its extension — the set of rows that currently satisfy the predicate in the database — is what you read, update, or delete.

Install

pip install half_orm

Configure

# ~/.half_orm/blog
[database]
name = blog
user = alice
password = secret
host = localhost

Usage

from half_orm.model import Model

blog = Model('blog')
Post   = blog.get_relation_class('blog.post')
Author = blog.get_relation_class('blog.author')

# Insert
alice = Author(
    first_name='Alice', last_name='Martin', email='alice@example.com'
).ho_insert()

# Query — Author(last_name='Martin') is the predicate "is an author named Martin"
for row in Author(last_name='Martin').ho_select('id', 'email'):
    print(row)

# Update a singleton (predicate identifies exactly one row)
Author(id=alice['id']).ho_assert_is_singleton().ho_update(email='alice@newdomain.com')

# Delete
Author(id=alice['id']).ho_assert_is_singleton().ho_delete()

Documentation

License

halfORM is licensed under the GPL-3.0 license.

Metadata

Release files for half-orm 0.18.14

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

Source distribution (sdist)

Source distribution for half-orm 0.18.14
File Size Uploaded Provenance
half_orm-0.18.14.tar.gz 73.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for half-orm 0.18.14
File Interpreter ABI Platform
half_orm-0.18.14-py3-none-any.whl Python 3 none any Details

Total release size: 142.3 kB

Release files / half_orm-0.18.14.tar.gz

Download URL half_orm-0.18.14.tar.gz
Size 73.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9b2092736a71920c5b5a8630825201e10916ce6ea7cc541cd6e96c3d21d5b831
BLAKE2b-256 checksum
How to use checksums
4dca110a91c7383f01e5284eadf83798bdc04d92d1e9bb9aed1c6c7137e7f6b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / half_orm-0.18.14-py3-none-any.whl

Download URL half_orm-0.18.14-py3-none-any.whl
Size 68.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8430d428ce1a6afaf7eda859ff05a470177a4a62c92e7b0ef81f4e24d9ae5db1
BLAKE2b-256 checksum
How to use checksums
7c6dfe29b4c0da29f289adbd8de72f81a2b50e36c49c144d3c672a50c08e62a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for half-orm 0.18.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.

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.

Release history Release notifications | RSS feed

This release

0.18.14 This release

2 release files No provenance

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