Skip to content

0.15.0

Compare
Choose a tag to compare
@igorbenav igorbenav released this 18 Sep 06:04
· 21 commits to main since this release
5c442ec

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 to upsert_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 to cryptography = "^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 with update_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 in upsert_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

New Contributors

Full Changelog: v0.14.0...v0.15.0

You may also see this in the docs.