Repository navigation
v0.2.1
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_datamethod 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
DBModelclass.
Tests
- Added unit tests for the
_create_instance_from_dataand_prepare_fields_to_updatemethods, including tests for handling foreign key values. - Created a new test file
test_prepare_values_to_insert.pyto test the_prepare_values_to_insertmethod. - 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
Nonefor 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
- Define table schema using Pydantic models
- Basic CRUD operations
- Save data to the database
- Read data from the database
- Update data in the database
- Delete data from the database
- Relationships between tables
- One-to-many
- Create a tables with a foreign key
- Save data with a foreign key
- Read data with a foreign key
- 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
- One-to-many
- Custom primary key
- Bulk operations (save, update, delete)
- Migrations
Full Changelog: v0.2.0...v0.2.1