Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tombulled/pydantabase

Pydantic integration for TinyDB
https://github.com/tombulled/pydantabase

Last synced: 23 days ago
JSON representation

Pydantic integration for TinyDB

Awesome Lists containing this project

README

        

# pydantabase
Pydantic integration for TinyDB

## Example:
```python
import pydantabase
import tinydb.storages

class Person(pydantabase.BaseModel):
name: str
age: int

class Database(pydantabase.Database):
default_storage_class = tinydb.storages.MemoryStorage

db = Database(Person)

db.insert_multiple([
Person(
name = 'Paul',
age = 53,
),
Person(
name = 'Rebecca',
age = 47,
),
])
```

```python
>>> db.get(tinydb.Query().name == 'Paul')
Person(name='Paul', age=53)
```