Releases: codemation/pydbantic
Releases · codemation/pydbantic
0.0.16
0.0.15 - Filter operators and pagination
What's Changed
- Filter operators and pagination by @codemation in #17
Full Changelog: 0.0.14...0.0.15
0.0.14
What's Changed
- Fix/Enhancement - Improved db connection context manager by @codemation in #15
Full Changelog: 0.0.13...0.0.14
Migration Improvement - multi app same db support
Whats changed?
Multi App same DB support & Improvement Migrations - replaced complete TableMeta
lookups during compare_tables_and_migrate
with tables in self.tables, thus allowing the same database
to be used accross multiple applications that do not share model definitions.
0.0.12 - Field Support for Arrays of Foreign DataBaseModel - Fixed MySQL
- Fixed SqlAlchemy Column Type selection preventing foreign model usage with arrays in MySQL
0.0.11 - Field Support for Arrays of Foreign DataBase Models
- Improved support for foreign model updates, .save() will invoke creation of foreign objects if not existing,
- Added support for Arrays of Foreign References where a single field in a DataBaseModel may contain a list of other DataBaseModel objects
from uuid import uuid4
from datetime import datetime
from typing import List, Optional
from pydbantic import DataBaseModel, PrimaryKey
def time_now():
return datetime.now().isoformat()
def get_uuid4():
return str(uuid4())
class Coordinate(DataBaseModel):
time: str = PrimaryKey(default=time_now)
latitude: float
longitude: float
class Journey(DataBaseModel):
trip_id: str = PrimaryKey(default=get_uuid4)
waypoints: List[Optional[Coordinate]]