Sqlactive

Latest version: v0.3.3

Safety actively analyzes 723152 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

0.3.3

[0.3.3](https://github.com/daireto/sqlactive/compare/v0.3.2...v0.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 `Query` type for `Select[tuple[T, ...]]`.
- Added `get_query_root_cls` util function to get the root class of a `sqlalchemy.sql.Select` instance.

Enhancements
- Moved `flatten_nested_filter_keys`, `create_eager_load_option`, and `eager_expr_from_schema` functions from `SmartQueryMixin` to utils.

Documentation
- Updated the documentation to reflect the changes.

0.3.2

[0.3.2](https://github.com/daireto/sqlactive/compare/v0.3.1...v0.3.2) (2025-03-12)

> Changes the way the `Self` type is imported depending on the Python version.

Fixed
- **Change `Self` type import**: Use `typing_extensions.Self` for Python versions < 3.11 and `typing.Self` for Python versions >= 3.11.

0.3.1

[0.3.1](https://github.com/daireto/sqlactive/compare/v0.3.0...v0.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 `SQLAlchemyError` instead 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.

0.3.0

[0.3.0](https://github.com/daireto/sqlactive/compare/v0.2.0...v0.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()` and `take()` functions.
- Custom exceptions for different cases.

Enhancements

- Enhanced support for retrieving models with composite primary keys using the `get()` and `get_or_fail()` methods.
- Replaced `inspect(cls).mapper` with `__mapper__`.
- Attribute validation in the `fill()` method.
- New types for columns and attributes.

Fixed

- Improved `docstrings` and code formatting.
- Fixed examples and documentation.
- Using the `select_columns` argument of `group_by` method was replacing the query by a new one.

0.2.0

[0.2.0](https://github.com/daireto/sqlactive/compare/v0.1.0...v0.2.0) (2025-02-10)

> Added new query methods for counting and searching rows. The `select` query method has been improved to allow replacing the columns clause without affecting other clauses such as `FROM`, `ORDER BY`, and `GROUP BY`.

Added

- Introduced `top`, `count`, `unique_count`, and `search` query methods.

Enhancements

- Improved the `select` query method to preserve existing clauses, including `FROM`.

0.1.0

[0.1.0](https://github.com/daireto/sqlactive/commits/v0.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](https://docs.peewee-orm.com/en/latest/).
- **Django-like queries**: Perform intuitive and [expressive queries](https://docs.djangoproject.com/en/1.10/topics/db/queries/#lookups-that-span-relationships).
- **Nested eager loading**: Load nested relationships efficiently.
- **Automatic timestamps**: Auto-manage `created_at` and `updated_at` fields.
- **Dictionary serialization**: Convert models to JSON-friendly dictionaries with ease.

Links

Releases

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.