0.15.0
0.15.0 Summary
Added
- Models and Schemas for Task Management (Batch 3) by @slaarti
- Models and Schemas for Articles, Authors, and Profiles (Batch 4) by @slaarti
update_override
Argument toupsert_multi
Method by @feluelle- Configurable
is_deleted
Field in Soft Delete Logic by @gal-dahan
Improved
- Fixed Complex Parameter Filter with
between
Operator by @wu-clan - Fixed Cryptography Package Vulnerability by @igorbenav
- Resolved Update Column Name Collision in Update Method by @igorbenav
Fixed
- Vulnerability in
cryptography
Package updated tocryptography = "^43.0.1"
by @igorbenav - Update Column Name Collision in the
update
method by @igorbenav
Documentation Updates
- Added Documentation for New Models and Schemas by @slaarti
- Updated
upsert_multi
Method Documentation withupdate_override
Usage by @feluelle - Clarified Endpoint Simplification and Deprecation Notices by @igorbenav
Warnings
- Deprecation Notice: The
_read_paginated
endpoint has been removed. Please transition to using_read_items
with pagination parameters. Docs here. - Deprecation Notice: Handling of
Depends
is now only callable within_inject_depend
. Update your code accordingly. - Configuration Change Alert: Endpoints are simplified by default. Adjust your configurations to align with the new defaults. Docs here.
Details
Endpoint Simplification and Deprecation of _read_paginated
Description
To streamline API endpoint configurations, endpoints with empty strings as names are now the standard. Additionally, the _read_paginated endpoint has been removed, with its functionality merged into _read_items.
Changes
- Simplified Endpoint Configuration: Endpoints can now be defined with empty strings to create cleaner paths.
- Removed
_read_paginated Endpoint
: Pagination is now handled via optional parameters in_read_items
.
Usage Examples
Paginated Read Example:
curl -X 'GET' \
'http://localhost:8000/items?page=2&itemsPerPage=10' \
-H 'accept: application/json'
Non-Paginated Read Example:
curl -X 'GET' \
'http://localhost:8000/items?offset=0&limit=100' \
-H 'accept: application/json'
Warnings
Warning
Deprecation Warning: The _read_paginated endpoint is deprecated. Use _read_items with pagination parameters instead.
Warning
Configuration Change: Default endpoint names are now empty strings. Adjust your configurations to match the new defaults.
update_override
Argument in upsert_multi
Method
Description
The upsert_multi
method now includes an update_override
argument, giving developers the ability to override the default update logic during upsert operations. This enhancement provides greater flexibility for custom update scenarios, such as utilizing SQL CASE
statements or other complex expressions.
Changes
update_override
Argument: Allows custom update logic inupsert_multi
.- Dialect Support: Implemented for PostgreSQL, SQLite, and MySQL.
- Tests: Added comprehensive tests to ensure functionality across different SQL dialects.
Usage Example
from fastcrud import FastCRUD
from sqlalchemy import case
from .models.item import Item
from .database import session as db
crud_items = FastCRUD(Item)
await crud_items.upsert_multi(
db=db,
instances=[
ItemCreateSchema(id=1, name="Item A", price=10),
ItemCreateSchema(id=2, name="Item B", price=20),
],
update_override={
"price": case(
(Item.price.is_(None), db.excluded.price),
else_=Item.price,
)
}
)
Configurable is_deleted
Field in Soft Delete Logic
Description
The is_deleted
field in the soft delete logic is now optional and configurable. This change allows developers to customize the soft delete behavior per model, providing flexibility in how deletion states are handled.
What's Changed
- Models and Schemas, Batch 3: Task Management by @slaarti in #140
- fix complex parameter filter with between by @wu-clan in #150
- Add update override arg to upsert_multi by @feluelle in #153
- Make
is_deleted
Field Optional and Configurable in Soft Delete Logic by @gal-dahan in #152 - Models and Schemas, Batch 4: Articles, Authors, and Profiles by @slaarti in #151
- fix for cryptography issue by @igorbenav in #161
- Fix update column by @igorbenav in #162
- Preparations for
0.15.0
by @igorbenav in #163 - added changelog, changed pyproject version by @igorbenav in #164
New Contributors
- @wu-clan made their first contribution in #150
- @gal-dahan made their first contribution in #152
Full Changelog: v0.14.0...v0.15.0
You may also see this in the docs.