Skip to main content

pyorm

Leichtgewichtiges Mini-ORM für SQLite, PostgreSQL und MySQL — kein SQLAlchemy, keine Migrationen, kein globaler Connection-State. Database-Instanzen werden explizit erzeugt und an jeden Model-Aufruf durchgereicht.

Installation

pip install -e .[dev]          # nur SQLite (stdlib)
pip install -e .[dev,postgres] # + psycopg2
pip install -e .[dev,mysql]    # + mysql-connector-python

Beispiel

from pyorm import Database, BaseModel

class User(BaseModel):
    __table__ = "users"
    __primary_key__ = "id"
    __slots__ = ("id", "name", "email", "_db")

db = Database.sqlite(":memory:")
db.execute("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, email TEXT)")

user = User.create(db, name="Ada", email="ada@example.com")
found = User.get(db, id=user.id)

with db.transaction():
    found.update(name="Ada Lovelace")

Für Postgres/MySQL statt Database.sqlite(...):

db = Database.postgres(host="localhost", dbname="app", user="app", password="...")
db = Database.mysql(host="localhost", database="app", user="app", password="...")

Tests

pytest                                  # SQLite-Tests laufen immer
PYORM_TEST_PG_DSN="host=localhost dbname=test user=test password=test" pytest
PYORM_TEST_MYSQL_DSN="host=localhost;database=test;user=test;password=test" pytest

Ohne gesetzte DSN-Umgebungsvariable werden die Postgres-/MySQL-Tests übersprungen.

Download files

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

Source Distribution

dialectorm_m1kad0-0.1.2.tar.gz (12.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dialectorm_m1kad0-0.1.2-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file dialectorm_m1kad0-0.1.2.tar.gz.

File metadata

  • Download URL: dialectorm_m1kad0-0.1.2.tar.gz
  • Upload date:
  • Size: 12.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for dialectorm_m1kad0-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8b1aa8912f623038ef4c8158a6b44fba32ffea6518331f4dc06575d3b8321382
MD5 810e45c3068af2337c5b08ce05b87092
BLAKE2b-256 3921e0f41b38358bfb551c2875b8a08b6f2e3d9dfa9b41e29597f22191937659

See more details on using hashes here.

File details

Details for the file dialectorm_m1kad0-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for dialectorm_m1kad0-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2c687ea50a043a1da7afbb7b920e9e661b82d4ff2bc21ba47cd6986ef8a7ea94
MD5 8254284b88d5f58016f20cd03880ca4d
BLAKE2b-256 4db2d49ff541e6d6d2fbaa21f7533e8169708f9f19cc0b1d6b04ab1fbc80703c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 files

0.1.1

2 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