Releases: collerek/ormar
Releases · collerek/ormar
Fix UUID foreign keys
Fix issue #71
Fix unneeded related models overwrite in update
Fix issue #70
Fix saving model with related models
Fix for #68
Add Signals
- Breaking: QuerySet
bulk_update
method now raisesModelPersistenceError
for unsaved models passed instead ofQueryDefinitionError
- Breaking: Model initialization with unknown field name now raises
ModelError
instead ofKeyError
- Added Signals, with pre-defined list signals and decorators:
post_delete
,post_save
,post_update
,pre_delete
,
pre_save
,pre_update
- Add
py.typed
and modifysetup.py
for mypy support - Performance optimization
- Updated docs
Introduce property_field, bug fixes and performance optimization
- Performance optimization
- Fix for bug with
pydantic_only
fields being required - Add
property_field
decorator that registers a function as a property that will
be included inModel.dict()
and infastapi
response - Update docs
Fix setting default values on excluded fields
Fix issue #60
Expose QuerysetProxy on reverse ForeignKey, add more QuerySet methods to QuerysetProxy
Pre-release
- Breaking: calling instance.load() when the instance row was deleted from db now raises ormar.NoMatch instead of ValueError
- Breaking: calling add and remove on ReverseForeignKey relation now updates the child model in db setting/removing fk column
- Breaking: ReverseForeignKey relation now exposes QuerySetProxy API like ManyToMany relation
- Breaking: querying related models from ManyToMany cleans list of related models loaded on parent model:
- Example:
post.categories.first()
will set post.categories to list of 1 related model -> the one returned by first() - Example 2: if post has 4 categories so
len(post.categories) == 4
callingpost.categories.limit(2).all()
-> will load only 2 children and nowassert len(post.categories) == 2
- Example:
- Added
get_or_create
,update_or_create
,fields
,exclude_fields
,exclude
,prefetch_related
andorder_by
to QuerySetProxy
so now you can use those methods directly from relation - Update docs
Fix for alembic autogenaration of migration `UUID` columns
- Fix for alembic autogenaration of migration
UUID
columns. It should just produce sqlalchemyCHAR(32)
orCHAR(36)
- In order for this to work you have to set user_module_prefix='sa.' (must be equal to sqlalchemy_module_prefix option (default 'sa.'))
Allow passing uuid_format to UUID field
-
Allow to pass
uuid_format
(allowed 'hex'(default) or 'string') toUUID
field to change the format in which it's saved.
By default field is saved in hex format (trimmed to 32 chars (without dashes)), but you can pass
format='string' to use 36 (with dashes) instead to adjust to existing db or other libraries.Sample:
- hex value = c616ab438cce49dbbf4380d109251dce
- string value = c616ab43-8cce-49db-bf43-80d109251dce
Fix dumping models to dict with include/exclude
Merge pull request #56 from collerek/fix_dict_dumping Fix dict dumping of models with exclude/include set