Changelog¶
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[0.2.0] - 2026-02-06¶
Added¶
@queryDecorator: Declarative SQL/expression queries on repository methods via AOP interception.RepositoryQueryInterceptor: NewMethodInterceptorthat executes SQL text or SQLAlchemy expressions, with automatic pagination support.- Pagination:
PageRequest,Page, andSortdataclasses for paginated and sorted query results. - Sort Validation:
Sort.__post_init__rejects invalid directions (only"ASC"/"DESC"allowed). @transactionalwithout parentheses: Decorator now works both as@transactionaland@transactional(propagation=...).- Export:
Sortadded to__init__.pyand__all__. - Full MkDocs documentation site with Material theme: quickstart, architecture, reference guides (configuration, declarative-base, repository, transactions), FAQ.
tests/test_pagination_sort.py: Pagination and sorting tests.tests/test_repository_interceptor_coverage.py: Repository interceptor edge-case tests.tests/test_repository_query.py: Full query execution tests.- GitHub Actions workflow for documentation deployment.
Changed¶
- Code Quality: Major refactoring of
repository_interceptor.py— extracted helper functions (_extract_page_request,_build_order_by_clause,_execute_count_query,_execute_paginated_query,_execute_simple_query). - Code Quality: Refactored
session.py— extracted_build_engine_kwargs,_should_rollback, split propagation modes into individual async generators via dispatch table. - Documentation: Overhauled README and all reference docs.
- CI/CD: Unified documentation deployment workflow.
- Bumped
pico-iocdependency to>= 2.2.0. - Dropped Python 3.10 from CI matrix.
Fixed¶
- Dynamic Sorting Safety: Prevent dynamic column sorting in raw SQL mode to avoid injection.
[0.1.1] - 2025-11-18¶
Fixed¶
- Architecture: Removed the global
_default_managersingleton ("Service Locator" anti-pattern).SessionManageris now purely managed by the IoC container. - Decorators: Refactored
@transactionalto usepico-ioc's AOP system (@intercepted_by) instead of manual function wrapping. This ensures proper dependency injection of theSessionManagerinto the interceptor, enabling support for multiple databases/managers in the future. - Cleanup: Removed unused
REPOSITORIESglobal set. - Updated dependency requirement to
pico-ioc>=2.1.3.
Changed¶
- Internal:
SessionManagerno longer registers itself globally upon instantiation. Components needing a session manager must have it injected or be intercepted byTransactionalInterceptor.
[0.1.0]¶
Added¶
- Initial public release of
pico-sqlalchemy. - Async-Native Core: Built entirely on SQLAlchemy's async ORM (
AsyncSession,create_async_engine). @transactionaldecorator providing Spring-style, async-native transactional method boundaries with propagation modes:REQUIRED,REQUIRES_NEW,SUPPORTS,MANDATORY,NOT_SUPPORTED, andNEVER.SessionManagersingleton responsible for:- creating the SQLAlchemy
AsyncEngine - managing
AsyncSessioninstances - implementing async transaction semantics
await commit()/await rollback()behaviorget_session()helper for retrieving the currently activeAsyncSessioninside transactional methods.TransactionalInterceptorimplementing AOP-based async transaction handling for methods decorated with@transactional.DatabaseSettingsdataclass for type-safe, IOC-managed configuration of SQLAlchemy (URL, pool options, echo).DatabaseConfigurerprotocol for extensible, ordered database initialization hooks (e.g., migrations, DDL, seeding).SqlAlchemyFactoryto register and wire theSessionManagerand configuration into the IoC container.AppBase,Mapped, andmapped_columndeclarative base components registered for SQLAlchemy models.- Async-native in-memory SQLite support (
aiosqlite) out of the box (useful for testing). - Test suite validating async
SessionManagercommit/rollback behavior and transactional propagation.