Releases: daireto/sqlactive
v0.4.0
0.4.0 (2026-03-22)
Introduced breaking API changes in connection and execution handling to make async session management explicit and enforce a stronger shutdown flow.
Breaking Changes
execute()signature has changed:- Before: session was resolved from
base_model(orActiveRecordBaseModelby default). - Now: it requires
async_scoped_sessionexplicitly as the first argument.
- Before: session was resolved from
DBConnection.close()signature has changed:- Before: accepted an optional
base_model. - Now: takes no arguments.
- Before: accepted an optional
SessionMixin.close_session()has been removed.
Changed
DBConnection.init_db()now supports multiple base models via*base_models.DBConnection.close()now performs a hard shutdown flow:- removes the scoped session from the current scope with
remove(), - unbinds
async_sessionmakerviaconfigure(bind=None), - and disposes the engine via
dispose().
- removes the scoped session from the current scope with
Fixed
- After
close(), attempts to reuse the session for query execution now fail explicitly due to missingbind(intended behavior to prevent accidental reuse).
Migration Notes
- Replace:
await execute(query, BaseModel)→await execute(conn.async_scoped_session, query)await conn.close(BaseModel)→await conn.close()
- If you relied on
SessionMixin.close_session(), remove that call and manage lifecycle throughDBConnection.close().
v0.3.6
0.3.6 (2025-06-05)
Introduced improvements in object manipulation using the magic methods
__getitem__and__setitem__, as well as enhancements in documentation and project configuration.
Added
- Implementation of the magic methods
__getitem__and__setitem__for more flexible data handling.
Enhancements
- Resolved issues with
ruffin docstrings and code, improving overall project quality. - Added
ruffconfiguration to standardize code format and style.
Fixed
- Corrections in docstrings and code to comply with
ruffrules.
Refactored
- Changed multiple functions to imperative mode for better code clarity.
Documentation
- Added usage examples for the methods
__getitem__and__setitem__. - Updated function and property descriptions across the API documentation.
v0.3.5
0.3.5 (2025-05-13)
Added new specific exceptions and improved docstring formatting.
Added
- Introduced new specific exceptions to enhance error handling.
Fixed
- Resolved issues in docstrings and improved formatting using Ruff.
- Corrected the use of exceptions in documentation.
- Fixed minor issues in package configuration.
Refactored
- Updated module and class docstrings for better clarity.
- Reformatted code using Ruff for consistency.
v0.3.4
v0.3.3
0.3.3 (2025-03-16)
Introduces a new type for queries and improves the code structure by moving independent functions to the utils module.
Added
- Added
Querytype forSelect[tuple[T, ...]]. - Added
get_query_root_clsutil function to get the root class of asqlalchemy.sql.Selectinstance.
Enhancements
- Moved
flatten_nested_filter_keys,create_eager_load_option, andeager_expr_from_schemafunctions fromSmartQueryMixinto utils.
Documentation
- Updated the documentation to reflect the changes.
v0.3.2
v0.3.1
0.3.1 (2025-03-03)
Introduces improvements in exception handling, code optimization, and updated documentation to reflect recent changes.
Added
- New custom exceptions: Added new custom exceptions to improve error management.
Enhancements
- Improved error messages: Error messages are now more descriptive, providing better feedback to users.
- Code optimization: Refactored the code to improve readability and efficiency.
Fixed
- Use
SQLAlchemyErrorinstead of a custom exception: Now using the native SQLAlchemy exception for better compatibility and consistency with the library.
Documentation
- Updated the documentation to reflect the changes, including the Raises section for exception handling.
v0.3.0
0.3.0 (2025-02-22)
Introduced context manager functionality to use temporary records, custom exceptions, and validation improvements. Enhanced ORM handling, added new column types, refined documentation and formatted code.
Added
- Context manager functionality.
- Introduced
distinct()andtake()functions. - Custom exceptions for different cases.
Enhancements
- Enhanced support for retrieving models with composite primary keys using the
get()andget_or_fail()methods. - Replaced
inspect(cls).mapperwith__mapper__. - Attribute validation in the
fill()method. - New types for columns and attributes.
Fixed
- Improved
docstringsand code formatting. - Fixed examples and documentation.
- Using the
select_columnsargument ofgroup_bymethod was replacing the query by a new one.
v0.2.0
0.2.0 (2025-02-10)
Added new query methods for counting and searching rows. The
selectquery method has been improved to allow replacing the columns clause without affecting other clauses such asFROM,ORDER BY, andGROUP BY.
Added
- Introduced
top,count,unique_count, andsearchquery methods.
Enhancements
- Improved the
selectquery method to preserve existing clauses, includingFROM.
v0.1.0
0.1.0 (2025-02-09)
First release.
Features
- Asynchronous Support: Async operations for better scalability.
- ActiveRecord-like methods: Perform CRUD operations with a syntax similar to Peewee.
- Django-like queries: Perform intuitive and expressive queries.
- Nested eager loading: Load nested relationships efficiently.
- Automatic timestamps: Auto-manage
created_atandupdated_atfields. - Dictionary serialization: Convert models to JSON-friendly dictionaries with ease.