Skip to content

v0.2.1

Choose a tag to compare

@SpaceShaman SpaceShaman released this 23 Jul 21:53
· 305 commits to master since this release

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

  • 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
  • Custom primary key
  • Bulk operations (save, update, delete)
  • Migrations

Full Changelog: v0.2.0...v0.2.1