Skip to main content

A simple ORM with history tracking for rapid POC development

Project description

AutoDLA

A lightweight, powerful and modern ORM focused on simplifying development.

Documentation

Installation

Using PyPi

pip install autodla

From source

git clone https://github.com/GuzhiRegem/autoDLA.git
cd autoDLA/
pip install .

Features

To keep AutoDLA as lightweight as possible, you need to install separatelly the features you need to use, that includes the DataBase connection you are going to use, to install a feature, you can run the installation command as follows:

pip install autodla[<package_name>]

For example, PostgreSQL connection:

pip install autodla[db-postgres]

MemoryDB comes bundled with AutoDLA for quick prototyping without any external dependencies.

How to use

AutoDLA works with models, to start, you'll need to first build a usable model that inherits from Object:

from autodla import Object, primary_key

class User(Object):
    id: primary_key = primary_key.auto_increment()
    name: str
    age: int

WARNING: For model definition there is 1 rule to ensure good data integrity:

  • Each Model should have one and only one field of type primary_key (id in this case)

If you try to use this, it will fail, as the main focus of the library is to interact with a DataBase, you need a DataBase connection, we'll use PostgreSQL for this example.

pip install autodla[db-postgres] #install db connector

We need to instanciate the DataBase and then attach the Model into it.

from autodla.dbs import PostgresDB, MemoryDB

# Use MemoryDB() for pure in-memory work. PostgresDB maintains a local
# SQLite store and syncs it to PostgreSQL in the background.
db = MemoryDB()
db.attach([User])

Done!

You now can use your object as you would normally and the changes are going to be reflected on the DataBase, enjoy!


Uses

Create a user

user = User.new(name="John", age=30)

Retrieve all users

users = User.all(limit=None, skip=0)

Integrity of python id for the percieved same object

print(id(user) === id(users[-1]))
# This prints True

This is protected under MIT licence

Project details


Download files

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

Source Distribution

autodla-0.2.8.tar.gz (197.7 kB view details)

Uploaded Source

Built Distribution

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

autodla-0.2.8-py3-none-any.whl (199.3 kB view details)

Uploaded Python 3

File details

Details for the file autodla-0.2.8.tar.gz.

File metadata

  • Download URL: autodla-0.2.8.tar.gz
  • Upload date:
  • Size: 197.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for autodla-0.2.8.tar.gz
Algorithm Hash digest
SHA256 63ff49b4689f4bb3df01a7b979c28a3213b6c3cefba415d7370d4f3f47407661
MD5 2e5ac8b49586ae898a6ad60c33ff80de
BLAKE2b-256 8eb94c20a7e439a1dd5063cd7cb2b0376c33753e7d737d43078fe3a42d07401e

See more details on using hashes here.

Provenance

The following attestation bundles were made for autodla-0.2.8.tar.gz:

Publisher: python-publish.yml on GuzhiRegem/autoDLA

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file autodla-0.2.8-py3-none-any.whl.

File metadata

  • Download URL: autodla-0.2.8-py3-none-any.whl
  • Upload date:
  • Size: 199.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for autodla-0.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 bd85e231073b32998353b439af6d7bf1c2b3a2aaf38c24eb023813a29fd2eb87
MD5 02955c7d939043a3683b6481af535ced
BLAKE2b-256 a0ba6eb2a988acc21c9482ca77884188b37cab1573173a47805714afecd28ca9

See more details on using hashes here.

Provenance

The following attestation bundles were made for autodla-0.2.8-py3-none-any.whl:

Publisher: python-publish.yml on GuzhiRegem/autoDLA

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page