Skip to content

v0.3.0

Choose a tag to compare

@SpaceShaman SpaceShaman released this 24 Jul 13:04
· 296 commits to master since this release

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

  • 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
        • Cascade
        • Set null
        • Restrict
        • Set default
        • No action
    • One-to-one
    • Many-to-many
  • Custom primary key
  • Bulk operations (save, update, delete)
  • Migrations

Full Changelog: v0.2.1...v0.3.0