# AutoDLA
A lightweight, powerful and modern ORM focused on simplifying development.
[Documentation](https://autoDLA.readthedocs.io/en/latest/)
## Installation
### Using PyPi
```bash
pip install autodla
```
### From source
```bash
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:
```bash
pip install autodla[<package_name>]
```
For example, PostgreSQL connection:
```bash
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](reference/object.md):
```python
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`](reference/primary_key.md) (`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.
```bash
pip install autodla[db-postgres] #install db connector
```
We need to instanciate the DataBase and then attach the Model into it.
```python
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
```python
user = User.new(name="John", age=30)
```
#### Retrieve all users
```python
users = User.all(limit=None, skip=0)
```
#### Integrity of python id for the percieved same object
```python
print(id(user) === id(users[-1]))
# This prints True
```
---
This is protected under MIT licence
Raw data
{
"_id": null,
"home_page": null,
"name": "autodla",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "orm, database, sql, postgresql, prototype, poc, history-tracking",
"author": null,
"author_email": "GuzhiRegem <sebastian.moreiradl@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/24/8b/1b46c454736e6e89c6d34c59aac98dccb0b7d7c19b811924dd7b9ecfa3d0/autodla-0.1.6.tar.gz",
"platform": null,
"description": "# AutoDLA\n\nA lightweight, powerful and modern ORM focused on simplifying development.\n\n[Documentation](https://autoDLA.readthedocs.io/en/latest/)\n\n## Installation\n\n### Using PyPi\n```bash\npip install autodla\n```\n\n### From source\n```bash\ngit clone https://github.com/GuzhiRegem/autoDLA.git\ncd autoDLA/\npip install .\n```\n\n### Features\n\nTo 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:\n```bash\npip install autodla[<package_name>]\n```\nFor example, PostgreSQL connection:\n```bash\npip install autodla[db-postgres]\n```\nMemoryDB comes bundled with AutoDLA for quick prototyping without any external\ndependencies.\n\n## How to use\n\nAutoDLA works with models, to start, you'll need to first build a usable model that inherits from [Object](reference/object.md):\n```python\nfrom autodla import Object, primary_key\n\nclass User(Object):\n id: primary_key = primary_key.auto_increment()\n name: str\n age: int\n```\n> **WARNING:** For model definition there is **1 rule** to ensure good data integrity:\n\n> - Each Model should have one and only one field of type [`primary_key`](reference/primary_key.md) (`id` in this case)\n\nIf 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.\n\n```bash\npip install autodla[db-postgres] #install db connector\n```\n\nWe need to instanciate the DataBase and then attach the Model into it.\n\n```python\nfrom autodla.dbs import PostgresDB, MemoryDB\n\n# Use MemoryDB() for pure in-memory work. PostgresDB maintains a local\n# SQLite store and syncs it to PostgreSQL in the background.\ndb = MemoryDB()\ndb.attach([User])\n```\n\nDone!\n\nYou now can use your object as you would normally and the changes are going to be reflected on the DataBase, enjoy!\n\n---\n\n### Uses\n\n#### Create a user\n```python\nuser = User.new(name=\"John\", age=30)\n```\n\n#### Retrieve all users\n```python\nusers = User.all(limit=None, skip=0)\n```\n\n#### Integrity of python id for the percieved same object\n```python\nprint(id(user) === id(users[-1]))\n# This prints True\n```\n\n---\n\nThis is protected under MIT licence\n",
"bugtrack_url": null,
"license": null,
"summary": "A simple ORM with history tracking for rapid POC development",
"version": "0.1.6",
"project_urls": {
"Bug Tracker": "https://github.com/GuzhiRegem/autoDLA/issues",
"Documentation": "https://github.com/GuzhiRegem/autoDLA#readme",
"Homepage": "https://github.com/GuzhiRegem/autoDLA"
},
"split_keywords": [
"orm",
" database",
" sql",
" postgresql",
" prototype",
" poc",
" history-tracking"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "78088858f6eecf61609f5102bf88a79985be6a8e7e288fd2b717d9165a54493c",
"md5": "b1ca1bb136988ef419cab149b7e56008",
"sha256": "5022e4090d2fb6b1c665824e801c06eca596d6d0478e5ddebc79281005d14d06"
},
"downloads": -1,
"filename": "autodla-0.1.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b1ca1bb136988ef419cab149b7e56008",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 194309,
"upload_time": "2025-07-14T23:38:07",
"upload_time_iso_8601": "2025-07-14T23:38:07.864806Z",
"url": "https://files.pythonhosted.org/packages/78/08/8858f6eecf61609f5102bf88a79985be6a8e7e288fd2b717d9165a54493c/autodla-0.1.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "248b1b46c454736e6e89c6d34c59aac98dccb0b7d7c19b811924dd7b9ecfa3d0",
"md5": "b52fbad048302f2772cb020585ab8439",
"sha256": "95539b91719569d24e297bd01bc3917167843c9ddd2cc98ac83e623db95312ed"
},
"downloads": -1,
"filename": "autodla-0.1.6.tar.gz",
"has_sig": false,
"md5_digest": "b52fbad048302f2772cb020585ab8439",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 193655,
"upload_time": "2025-07-14T23:38:09",
"upload_time_iso_8601": "2025-07-14T23:38:09.073321Z",
"url": "https://files.pythonhosted.org/packages/24/8b/1b46c454736e6e89c6d34c59aac98dccb0b7d7c19b811924dd7b9ecfa3d0/autodla-0.1.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-14 23:38:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "GuzhiRegem",
"github_project": "autoDLA",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "typing_extensions",
"specs": [
[
"==",
"4.14.1"
]
]
},
{
"name": "fastapi",
"specs": [
[
"==",
"0.116.0"
]
]
},
{
"name": "uvicorn",
"specs": [
[
"==",
"0.35.0"
]
]
},
{
"name": "polars",
"specs": [
[
"==",
"1.31.0"
]
]
},
{
"name": "psycopg2-binary",
"specs": [
[
"==",
"2.9.10"
]
]
},
{
"name": "pydantic",
"specs": [
[
"==",
"2.11.7"
]
]
},
{
"name": "python-multipart",
"specs": [
[
"==",
"0.0.20"
]
]
}
],
"lcname": "autodla"
}