A simple ORM with history tracking for rapid POC development
Project description
AutoDLA
A lightweight, powerful and modern ORM focused on simplifying development.
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(idin 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63ff49b4689f4bb3df01a7b979c28a3213b6c3cefba415d7370d4f3f47407661
|
|
| MD5 |
2e5ac8b49586ae898a6ad60c33ff80de
|
|
| BLAKE2b-256 |
8eb94c20a7e439a1dd5063cd7cb2b0376c33753e7d737d43078fe3a42d07401e
|
Provenance
The following attestation bundles were made for autodla-0.2.8.tar.gz:
Publisher:
python-publish.yml on GuzhiRegem/autoDLA
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
autodla-0.2.8.tar.gz -
Subject digest:
63ff49b4689f4bb3df01a7b979c28a3213b6c3cefba415d7370d4f3f47407661 - Sigstore transparency entry: 332516061
- Sigstore integration time:
-
Permalink:
GuzhiRegem/autoDLA@381b552513268765293c61989b4eede2da4f4f73 -
Branch / Tag:
refs/tags/v0.2.8 - Owner: https://github.com/GuzhiRegem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@381b552513268765293c61989b4eede2da4f4f73 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd85e231073b32998353b439af6d7bf1c2b3a2aaf38c24eb023813a29fd2eb87
|
|
| MD5 |
02955c7d939043a3683b6481af535ced
|
|
| BLAKE2b-256 |
a0ba6eb2a988acc21c9482ca77884188b37cab1573173a47805714afecd28ca9
|
Provenance
The following attestation bundles were made for autodla-0.2.8-py3-none-any.whl:
Publisher:
python-publish.yml on GuzhiRegem/autoDLA
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
autodla-0.2.8-py3-none-any.whl -
Subject digest:
bd85e231073b32998353b439af6d7bf1c2b3a2aaf38c24eb023813a29fd2eb87 - Sigstore transparency entry: 332516070
- Sigstore integration time:
-
Permalink:
GuzhiRegem/autoDLA@381b552513268765293c61989b4eede2da4f4f73 -
Branch / Tag:
refs/tags/v0.2.8 - Owner: https://github.com/GuzhiRegem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@381b552513268765293c61989b4eede2da4f4f73 -
Trigger Event:
release
-
Statement type: