Skip to main content

pythrel

Abstract relational ORM system

WARNING: This is a small project I built mainly to learn how to interface with a few different kinds of SQL database. If you would like to use this in production, no you don't!

Documentation:

Installation:

python3 -m pip install pythrel

Basic Usage:

from pythrel import SqliteDatabase, Pythrel, Record
import secrets
import random

# Create database adapter
db = SqliteDatabase(path="test.db")
db.create_table("customers", {"id": "INTEGER", "customerName": "TEXT", "favorite_number": "REAL"})
db.commit()

# Generate some data
CUSTOMERS = {}
for c in range(500):
    CUSTOMERS[c] = {
        "id": c,
        "customerName": secrets.token_urlsafe(8),
        "favorite_number": random.randint(0, 10000)
    }

# Insert data
db.query().insert("customers", list(CUSTOMERS.values())).execute()
db.commit()

# Connect DB instance to ORM
orm = Pythrel(db)

# Use database table rows as objects
print(orm.load_columns(Customer, "customers", "*")[0].dict())
orm.create(Customer, "customers", id=-10, customerName="John", favorite_number=-69)
john = orm.load_columns(Customer, "customers", "*", where="id < 0")[0]
print(john)
john.favorite_number = 1000
orm.save(john, key="id")
print(orm.load_query(Customer, orm.query().select("customers", "*").where("id < 0"))[0])

Metadata

Release files for pythrel 0.1.1

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

Source distribution (sdist)

Source distribution for pythrel 0.1.1
File Size Uploaded Provenance
pythrel-0.1.1.tar.gz 5.3 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 13.6 kB

Release files / pythrel-0.1.1.tar.gz

Download URL pythrel-0.1.1.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d8d9ed3d0ad62815564c18c1f318ce7d4be358a9b79ea1c37c256299f4dae81f
BLAKE2b-256 checksum
How to use checksums
953db399296be55c0f59da1b0423130ed7aae61622e68d6937a6f167a9571bef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.0 Linux/6.2.0-1011-azure

Release files / pythrel-0.1.1-py3-none-any.whl

Download URL pythrel-0.1.1-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ee08990ee3a6dfa812412f31d65ec3e27c21175b79a6839b358ead3185a7982
BLAKE2b-256 checksum
How to use checksums
23a1ccd68126892d5df8b9ef98a9d3ee04ac6fb9ee0bfd416b9df6cfeb52cde0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.0 Linux/6.2.0-1011-azure

Security for pythrel 0.1.1

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.1.1 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