Ormagic

Latest version: v0.15.0

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

Scan your dependencies

Page 2 of 4

0.12.0

This release introduces significant improvements in data filtering capabilities within the database. The new `Q` class allows for the creation of complex query filters using logical operators like AND, OR, and NOT. Additionally, refactoring has enhanced code readability and streamlined the handling of conditions in SQL queries.

Added
- **Support for Advanced Filters with the `Q` Class:**
- Introduced the `Q` class, enabling the creation of complex queries by combining various conditions using AND, OR, and NOT operators.
- Capability to construct intricate queries, such as filtering data with multiple `Q` objects using logical AND/OR.

Refactoring
- **Improved Condition Handling in Queries:**
- Refactored the `prepare_where_conditions` method to accept positional arguments.
- Simplified the `_fetch_raw_data` method by leveraging the refactored `prepare_where_conditions` function.
- Refactored the `Q` class and related methods to enhance readability and improve SQL condition management.

Example

python
q1 = Q(name="Alice")
q2 = Q(age__lt=25)
q3 = Q(weight__gte=70)
q4 = Q(name="Bob")
q5 = Q(age__gt=30)
q6 = Q(weight__lte=80)
q = Q(q1 & q2 | q3) | Q(q4 & q5 | q6)
User.filter(q)


This is equivalent to the following SQL WHERE clause:

sql
WHERE (name = 'Alice' AND age < 25 OR weight >= 70) OR (name = 'Bob' AND age > 30 OR weight <= 80)


Features and Roadmap

- [x] Define table schema using Pydantic models
- [x] Basic CRUD operations
- [x] Save data to the database
- [x] Read data from the database
- [x] Update data in the database
- [x] Delete data from the database
- [x] Relationships between tables
- [x] One-to-many
- [x] Create a tables with a foreign key
- [x] Save data with a foreign key
- [x] Read data with a foreign key
- [x] Update data with a foreign key
- [x] Delete data with a foreign key
- [X] Cascade
- [x] Set null
- [x] Restrict
- [x] Set default
- [x] No action
- [x] One-to-one
- [x] Many-to-many
- [x] Unique constraints
- [x] Remove table
- [x] Read all data from the database
- [x] Filter data and retrieve multiple records
- [x] Equal
- [x] Not equal
- [x] Greater than
- [x] Greater than or equal
- [x] Less than
- [x] Less than or equal
- [x] Like (Pattern matching with % and _)
- [x] Not like (Pattern matching with % and _)
- [x] In (List of values)
- [x] Not in (List of values)
- [x] Between (Two values)
- [x] Not between (Two values)
- [x] Q objects to combine filters (AND, OR, NOT)
- [x] Protect against SQL injection
- [x] Order by
- [x] Limit and offset
- [x] Update table schema
- [x] Add new column
- [x] Rename column
- [x] Drop column
- [ ] Custom primary key
- [ ] Functions
- [ ] Aggregate functions
- [ ] String functions
- [ ] Date and time functions
- [ ] Mathematical functions
- [ ] Control flow functions
- [ ] Bulk operations (save, update, delete)
- [ ] Migrations

**Full Changelog**: https://github.com/SpaceShaman/ORMagic/compare/v0.11.0...v0.12.0

0.11.0

New Feature
- Added functionality to drop columns from existing tables, providing more flexibility in managing database schemas.

This release focuses on enhancing database schema management by allowing the removal of columns from existing tables, further improving the flexibility and control over database structures.

Features and Roadmap

- [x] Define table schema using Pydantic models
- [x] Basic CRUD operations
- [x] Save data to the database
- [x] Read data from the database
- [x] Update data in the database
- [x] Delete data from the database
- [x] Relationships between tables
- [x] One-to-many
- [x] Create a tables with a foreign key
- [x] Save data with a foreign key
- [x] Read data with a foreign key
- [x] Update data with a foreign key
- [x] Delete data with a foreign key
- [X] Cascade
- [x] Set null
- [x] Restrict
- [x] Set default
- [x] No action
- [x] One-to-one
- [x] Many-to-many
- [x] Unique constraints
- [x] Remove table
- [x] Read all data from the database
- [x] Filter data and retrieve multiple records
- [x] Equal
- [x] Not equal
- [x] Greater than
- [x] Greater than or equal
- [x] Less than
- [x] Less than or equal
- [x] Like (Pattern matching with % and _)
- [x] Not like (Pattern matching with % and _)
- [x] In (List of values)
- [x] Not in (List of values)
- [x] Between (Two values)
- [x] Not between (Two values)
- [x] Protect against SQL injection
- [x] Order by
- [x] Limit and offset
- [x] Update table schema
- [x] Add new column
- [x] Rename column
- [x] Drop column
- [ ] Custom primary key
- [ ] Bulk operations (save, update, delete)
- [ ] Migrations

**Full Changelog**: https://github.com/SpaceShaman/ORMagic/compare/v0.10.1...v0.11.0

0.10.1

Refactoring & Code Reorganization
- Significant refactoring to improve code modularity, readability, and maintainability. The logic related to saving, updating, and managing database tables has been reorganized into dedicated modules (`data_saver.py` and `table_manager.py`), allowing for better separation of concerns.
- Renamed methods and variables for clarity and consistency across the codebase.

New Features
- Introduced support for column renaming and adding columns with constraints in the `update_table` method, enhancing the flexibility of schema updates.

SQLite Enhancements
- Enabled Write-Ahead Logging (WAL) mode in SQLite for improved performance and concurrency.

Testing
- Expanded tests to cover the new schema update features, ensuring reliability and robustness.

This update focuses on enhancing the internal structure of the code, making it more modular and easier to maintain, while also adding critical new functionality for database schema management.

Features and Roadmap

- [x] Define table schema using Pydantic models
- [x] Basic CRUD operations
- [x] Save data to the database
- [x] Read data from the database
- [x] Update data in the database
- [x] Delete data from the database
- [x] Relationships between tables
- [x] One-to-many
- [x] Create a tables with a foreign key
- [x] Save data with a foreign key
- [x] Read data with a foreign key
- [x] Update data with a foreign key
- [x] Delete data with a foreign key
- [X] Cascade
- [x] Set null
- [x] Restrict
- [x] Set default
- [x] No action
- [x] One-to-one
- [x] Many-to-many
- [x] Unique constraints
- [x] Remove table
- [x] Read all data from the database
- [x] Filter data and retrieve multiple records
- [x] Equal
- [x] Not equal
- [x] Greater than
- [x] Greater than or equal
- [x] Less than
- [x] Less than or equal
- [x] Like (Pattern matching with % and _)
- [x] Not like (Pattern matching with % and _)
- [x] In (List of values)
- [x] Not in (List of values)
- [x] Between (Two values)
- [x] Not between (Two values)
- [x] Protect against SQL injection
- [x] Order by
- [x] Limit and offset
- [ ] Update table schema
- [x] Add new column
- [x] Rename column
- [ ] Drop column
- [ ] Custom primary key
- [ ] Bulk operations (save, update, delete)
- [ ] Migrations

**Full Changelog**: https://github.com/SpaceShaman/ORMagic/compare/v0.10.0...v0.10.1

0.10.0

The latest version focuses on query enhancements and code readability improvements. Here are the key changes:

New Features
- Added support for `limit` and `offset` parameters in `DBModel` queries to enable pagination.

Refactoring
- Renamed variables in the `_fetch_raw_data` method for better clarity.
- Refactored the unique field check into a new `_is_unique_field` method for improved readability and reusability.

Tests
- Added tests in `test_pagination.py` for `limit` and `offset` functionality.
- Updated tests in `test_get.py` to ensure accurate validation of datetime fields.
- Removed outdated and redundant test files.

Documentation
- Updated `README.md` to include documentation for `limit` and `offset` parameters.
- Marked `limit` and `offset` as completed in the feature list.

In summary, this update introduces pagination support, improves code readability, and ensures comprehensive testing and documentation for the new features.

Features and Roadmap

- [x] Define table schema using Pydantic models
- [x] Basic CRUD operations
- [x] Save data to the database
- [x] Read data from the database
- [x] Update data in the database
- [x] Delete data from the database
- [x] Relationships between tables
- [x] One-to-many
- [x] Create a tables with a foreign key
- [x] Save data with a foreign key
- [x] Read data with a foreign key
- [x] Update data with a foreign key
- [x] Delete data with a foreign key
- [X] Cascade
- [x] Set null
- [x] Restrict
- [x] Set default
- [x] No action
- [x] One-to-one
- [x] Many-to-many
- [x] Unique constraints
- [x] Remove table
- [x] Read all data from the database
- [x] Filter data and retrieve multiple records
- [x] Equal
- [x] Not equal
- [x] Greater than
- [x] Greater than or equal
- [x] Less than
- [x] Less than or equal
- [x] Like (Pattern matching with % and _)
- [x] Not like (Pattern matching with % and _)
- [x] In (List of values)
- [x] Not in (List of values)
- [x] Between (Two values)
- [x] Not between (Two values)
- [x] Protect against SQL injection
- [x] Order by
- [x] Limit and offset
- [ ] Update table schema
- [ ] Custom primary key
- [ ] Bulk operations (save, update, delete)
- [ ] Migrations

**Full Changelog**: https://github.com/SpaceShaman/ORMagic/compare/v0.9.0...v0.10.0

0.9.0

The latest version introduces new functionality and improvements, particularly focusing on the `order_by` feature. Here are the key changes:

New Features
- Added support for the `order_by` clause in `filter` and `all` methods to handle sorting results by multiple fields.

Documentation
- Updated `README.md` to include documentation for the `order_by` functionality.
- Added a Changelog section with a link to release notes.
- Added an item to the checklist for protecting against SQL injection.

In summary, this update enhances the sorting capabilities of queries with the `order_by` clause and ensures robust testing and documentation for these features.

Features and Roadmap

- [x] Define table schema using Pydantic models
- [x] Basic CRUD operations
- [x] Save data to the database
- [x] Read data from the database
- [x] Update data in the database
- [x] Delete data from the database
- [x] Relationships between tables
- [x] One-to-many
- [x] Create a tables with a foreign key
- [x] Save data with a foreign key
- [x] Read data with a foreign key
- [x] Update data with a foreign key
- [x] Delete data with a foreign key
- [X] Cascade
- [x] Set null
- [x] Restrict
- [x] Set default
- [x] No action
- [x] One-to-one
- [x] Many-to-many
- [x] Unique constraints
- [x] Remove table
- [x] Read all data from the database
- [x] Filter data and retrieve multiple records
- [x] Equal
- [x] Not equal
- [x] Greater than
- [x] Greater than or equal
- [x] Less than
- [x] Less than or equal
- [x] Like (Pattern matching with % and _)
- [x] Not like (Pattern matching with % and _)
- [x] In (List of values)
- [x] Not in (List of values)
- [x] Between (Two values)
- [x] Not between (Two values)
- [x] Protect against SQL injection
- [x] Order by
- [ ] Pagination
- [ ] Update table schema
- [ ] Custom primary key
- [ ] Bulk operations (save, update, delete)
- [ ] Migrations

**Full Changelog**: https://github.com/SpaceShaman/ORMagic/compare/v0.8.1...v0.9.0

0.8.1

The latest version addresses a critical security issue and enhances the application's robustness. Here are the key changes:

Security Fixes
- Fixed an SQL injection vulnerability by updating `models.py` to use parameterized queries.

New Features
- Added support for parameterized queries in `execute_sql` in `sql_utils.py`.

Tests
- Added tests in `test_sql_injection.py` to ensure SQL injection is prevented and to verify the integrity of the list filter.

In summary, this update enhances the security of the application by fixing an SQL injection vulnerability and ensuring proper testing for SQL injection prevention.

Features and Roadmap

- [x] Define table schema using Pydantic models
- [x] Basic CRUD operations
- [x] Save data to the database
- [x] Read data from the database
- [x] Update data in the database
- [x] Delete data from the database
- [x] Relationships between tables
- [x] One-to-many
- [x] Create a tables with a foreign key
- [x] Save data with a foreign key
- [x] Read data with a foreign key
- [x] Update data with a foreign key
- [x] Delete data with a foreign key
- [X] Cascade
- [x] Set null
- [x] Restrict
- [x] Set default
- [x] No action
- [x] One-to-one
- [x] Many-to-many
- [x] Unique constraints
- [x] Remove table
- [x] Read all data from the database
- [x] Filter data and retrieve multiple records
- [x] Equal
- [x] Not equal
- [x] Greater than
- [x] Greater than or equal
- [x] Less than
- [x] Less than or equal
- [x] Like (Pattern matching with % and _)
- [x] Not like (Pattern matching with % and _)
- [x] In (List of values)
- [x] Not in (List of values)
- [x] Between (Two values)
- [x] Not between (Two values)
- [x] Protect against SQL injection
- [ ] Pagination
- [ ] Order by
- [ ] Update table schema
- [ ] Custom primary key
- [ ] Bulk operations (save, update, delete)
- [ ] Migrations

**Full Changelog**: https://github.com/SpaceShaman/ORMagic/compare/v0.8.0...v0.8.1

Page 2 of 4

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.