Ormagic

Latest version: v0.15.0

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

Scan your dependencies

Page 4 of 4

0.4.1

Not secure
The latest version includes minor updates, primarily focusing on aligning `on_delete` parameter values with Pydantic field specifications. Here are the main changes:

Code Refactoring
- Refactored the `_get_on_delete_action` method in `models.py` to handle the correct mapping of `on_delete` parameter values for foreign key actions.

Tests
- Updated `on_delete` parameter values in test functions in `test_delete.py` to match the correct values for Pydantic `Field` class.

Documentation
- Updated `README.md` to reflect the correct `on_delete` parameter values in the `Post` model fields.

In summary, this small update ensures the correct handling and documentation of `on_delete` parameter values.

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
- [ ] 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
- [ ] Many-to-many
- [x] Unique constraints
- [x] Remove table
- [ ] Update table schema
- [ ] Filter data and retrieve multiple records
- [ ] Custom primary key
- [ ] Bulk operations (save, update, delete)
- [ ] Migrations

**Full Changelog**: https://github.com/SpaceShaman/ORMagic/compare/v0.4.0...v0.4.1

0.4.0

Not secure
The new version of the project introduces several improvements and new features, focusing on defining unique constraints, enhancing database table management, and improving documentation. Here are the main changes:

New Features
- Added support for defining unique constraints in database table columns.
- Introduced the `drop_table` method in the `DBModel` class to drop a table from the database.

Tests
- Added a test case in `test_save.py` to ensure that the uniqueness constraint work properly.
- Added a test case for the `drop_table` method in `test_remove_table.py`.

Documentation
- Updated `README.md` to include information on defining unique constraints.
- Added instructions for deleting and updating tables in the `README.md`.
- Updated Features and Roadmap checklist

Continuous Integration
- Updated the `coverage.yml` to specify coverage for the `ormagic` package in the pytest command.

In summary, the new version brings support for unique constraints, new methods for managing database tables, and comprehensive updates to documentation and test coverage.

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
- [ ] 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
- [ ] Many-to-many
- [x] Unique constraints
- [x] Remove table
- [ ] Update table schema
- [ ] Filter data and retrieve multiple records
- [ ] Custom primary key
- [ ] Bulk operations (save, update, delete)
- [ ] Migrations

**Full Changelog**: https://github.com/SpaceShaman/ORMagic/compare/v0.3.0...v0.4.0

0.3.0

Not secure
The new version of the project includes numerous improvements and new features, mainly focused on supporting foreign key relationships between models, enhancing code organization, and increasing test coverage. Here are the main changes:

New Features
- Introduced support for `CASCADE`, `RESTRICT`, `SET DEFAULT`, `SET NULL` and `NO ACTION` on_delete actions for foreign key constraints.

Code Refactoring
- Refactored foreign key handling in the `DBModel` class for better readability and maintainability.
- Simplified logic for handling foreign key models in the `_prepare_values_to_insert` method.
- Improved foreign key constraint generation logic for better readability and maintainability.

Tests
- Updated the `db_cursor` fixture in `conftest.py` to use the `get_cursor` function and properly close the connection.
- Added test cases for deleting objects with foreign keys set to `CASCADE`, `RESTRICT`, `SET DEFAULT`, `SET NULL` and `NO ACTION`

Fixes
- Updated the `execute_sql` function in `sql_utils.py` to use the `get_cursor` function, ensuring foreign key support is enabled.

Documentation
- Added documentation in `README.md` on how to define foreign keys with custom `on_delete` actions.
- Provided examples in `README.md` on defining foreign keys with different `on_delete` options such as `SET_NULL`, `RESTRICT`, `SET_DEFAULT`, `NO_ACTION`, and `CASCADE`.

In summary, the new version brings advanced support for foreign key relationships, improved code organization, and comprehensive tests for key methods.

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
- [ ] 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
- [ ] One-to-one
- [ ] Many-to-many
- [ ] Custom primary key
- [ ] Bulk operations (save, update, delete)
- [ ] Migrations

**Full Changelog**: https://github.com/SpaceShaman/ORMagic/compare/v0.2.1...v0.3.0

0.2.1

Not secure
The new version of the project includes several improvements and new features, primarily focused on enhancing code organization, supporting more complex relationships between models, and increasing test coverage. Here are the main changes:

Code Refactoring
- Extracted common logic into separate methods for better readability and organization.
- Updated the `_create_instance_from_data` method signature to accept a tuple parameter instead of any type.

New Features
- Added support for updating model fields with nested objects when performing database updates.
- Introduced support for optional foreign key fields in the `DBModel` class.

Tests
- Added unit tests for the `_create_instance_from_data` and `_prepare_fields_to_update` methods, including tests for handling foreign key values.
- Created a new test file `test_prepare_values_to_insert.py` to test the `_prepare_values_to_insert` method.
- Added tests to ensure the correct creation of instances with foreign key relationships and tests for getting and saving objects with optional foreign key fields set or not set.

Fixes
- Fixed handling of cases where the value is `None` for foreign key fields.

Miscellaneous
- Deleted the unnecessary test file `test_.py`.
- Added type-ignore comments to assertions in tests to ensure compatibility with optional foreign key fields.

In summary, the new version brings better code organization, new features for handling nested objects and optional foreign key fields, and comprehensive unit tests for key methods.

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
- [ ] Relationships between tables
- [ ] 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
- [ ] Delete data with a foreign key
- [ ] Set null
- [ ] Cascade
- [ ] Restrict
- [ ] No action
- [ ] Set default
- [ ] One-to-one
- [ ] Many-to-many
- [ ] Custom primary key
- [ ] Bulk operations (save, update, delete)
- [ ] Migrations

**Full Changelog**: https://github.com/SpaceShaman/ORMagic/compare/v0.2.0...v0.2.1

0.2.0

Not secure
Added

- One-to-many relationship between tables

Example
To define a foreign key, use other models as fields in the model.

python
from ormagic import DBModel

class User(DBModel):
name: str

class Post(DBModel):
title: str
content: str
user: User

User.create_table()
Post.create_table()

user = User(name="John")
user.save()

Post(title="Hello", content="World", user=user).save()

You can also save child models with new parent object in one step, this will save the parent object first and then the child object
Post(title="Hello", content="World", user=User(name="Alice")).save()


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
- [ ] Relationships between tables
- [ ] 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
- [ ] Delete data with a foreign key
- [ ] Set null
- [ ] Cascade
- [ ] Restrict
- [ ] No action
- [ ] Set default
- [ ] One-to-one
- [ ] Many-to-many
- [ ] Custom primary key
- [ ] Bulk operations (save, update, delete)
- [ ] Migrations


**Full Changelog**: https://github.com/SpaceShaman/ORMagic/compare/v0.1.0...v0.2.0

0.1.0

Not secure
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
- [ ] Custom primary key
- [ ] Bulk operations (save, update, delete)
- [ ] Relationships between tables
- [ ] One-to-one
- [ ] One-to-many
- [ ] Many-to-many
- [ ] Migrations

Page 4 of 4

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.