Metadata-Version: 2.1
Name: tileorm
Version: 0.1.1
Summary: An ORM for Tile38 inspired by Peewee - with Pydantic validation
License: MIT
Author: Alex Ward
Author-email: alxwrd@googlemail.com
Requires-Python: >=3.12,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: pydantic (>=2.9.2,<3.0.0)
Requires-Dist: pyle38 (>=0.14.2,<0.15.0)
Description-Content-Type: text/markdown

# 🌐 TileORM

[![Build](https://github.com/alxwrd/tileorm/actions/workflows/build.yaml/badge.svg)](https://github.com/alxwrd/tileorm/actions/workflows/deploy.yaml)

> [!WARNING]
> Not advisable for production critical workflows


## Getting started

```shell
pip install tileorm
```

```python
from tileorm import Model, Identifier, Group, CharField, Tile38

db = Tile38("redis://localhost:9851")

class Truck(Model):
    id: int = Identifier()
    group: str = Group()
    field: str = CharField()

    class Meta:
        database = db


truck1 = await Truck.create(
    id=1,
    group="fleet1",
    location=Point(lat=52.25, lon=13.37),
    field="value,
)

truck = Truck.get(id=1, group="fleet1") 
# Truck(id=1, location=Location(lat=52.25, lon=13.37), group='fleet1', field='value')

await db.get(truck.key, truck.id).withfields().exec()
# {'ok': True, 'object': {'type': 'Point', 'coordinates': [13.37, 52.25]}, 'fields': {'field': 'value'}, 'elapsed': '411.458µs'}
```

