Skip to content

v0.13.0

Compare
Choose a tag to compare
@SpaceShaman SpaceShaman released this 19 Aug 21:33
· 25 commits to master since this release

This update introduces a major feature—support for custom primary keys in models, enhancing flexibility in database schema design. Alongside this, several refinements and documentation improvements have been made to ensure better maintainability and user guidance.


Added

  • Custom Primary Keys:

    • Implemented support for custom primary key fields in models, allowing more flexible database schema definitions.
    • Updated documentation to include examples and guidelines for using custom primary keys.
  • Documentation Updates:

    • Added a new section on custom primary keys to the documentation.
    • Updated the README to reflect the completion of the custom primary key feature.

Example

from ormagic import DBModel, DBField

class User(DBModel):
    custom_id: int = DBField(primary_key=True)
    name: str

User.create_table()

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
  • Unique constraints
  • Remove table
  • Read all data from the database
  • Filter data and retrieve multiple records
    • Equal
    • Not equal
    • Greater than
    • Greater than or equal
    • Less than
    • Less than or equal
    • Like (Pattern matching with % and _)
    • Not like (Pattern matching with % and _)
    • In (List of values)
    • Not in (List of values)
    • Between (Two values)
    • Not between (Two values)
    • Q objects to combine filters (AND, OR, NOT)
  • Protect against SQL injection
  • Order by
  • Limit and offset
  • Update table schema
    • Add new column
    • Rename column
    • 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
  • Integration with other databases

Full Changelog: v0.12.1...v0.13.0