tortoise-orm

Familiar asyncio ORM for python, built with relations in mind

APACHE-2.0 License

Downloads
246.2K
Stars
4.3K
Committers
140

Bot releases are hidden (Show)

tortoise-orm - v0.15.23

Published by grigi over 4 years ago

This is a security fix release. We strongly recommend everyone upgrade.

  • Fixed SQL injection issue in MySQL
  • Fixed SQL injection issues in MySQL when using contains, starts_with or ends_with filters (and their case-insensitive counterparts)
  • Fixed malformed SQL for PostgreSQL and SQLite when using contains, starts_with or ends_with filters (and their case-insensitive counterparts)
tortoise-orm - v0.16.5

Published by grigi over 4 years ago

Bugfixes

  • Fix for generate_schemas param being ignored in tortoise.contrib.quart.register_tortoise
  • Fix join query with source_field param

Changed

  • Moved Tortoise.describe_model(<MODEL>, ...) to <MODEL>.describe(...)
  • Deprecated Tortoise.describe_model()
tortoise-orm - v0.15.22

Published by grigi over 4 years ago

  • Fix the aggregates using the wrong side of the join when doing a self-referential aggregation.
  • Fix for generate_schemas param being ignored in tortoise.contrib.quart.register_tortoise
tortoise-orm - v0.16.4

Published by grigi over 4 years ago

  • More consistent escaping of db columns, fixes using SQL reserved keywords as field names with a function.
  • Fix the aggregates using the wrong side of the join when doing a self-referential aggregation.
  • Fix F funtions wrapped forgetting about distinct=True
tortoise-orm - v0.16.3

Published by grigi over 4 years ago

  • Fixed invalid var IN () SQL generated using __in= and __not_in filters.
  • Fix bug with order_by on nested fields
  • Fix joining with self by reverse-foreign-key for filtering and annotation
tortoise-orm - v0.15.21 (legacy)

Published by grigi over 4 years ago

  • Fixed invalid var IN () SQL generated using __in= and __not_in filters.
  • Fix bug with order_by on nested fields
  • Fix joining with self by reverse-foreign-key for filtering and annotation
tortoise-orm - v0.16.2

Published by grigi over 4 years ago

  • Default values() & values_list() now includes annotations.
  • Annotations over joins now work correctly with values() & values_list()
  • Ensure GROUP BY precedes HAVING to ensure that filtering by aggregates work correctly.
  • Fix bug with join query with aggregation
  • Cast BooleanField values correctly on SQLite & MySQL
tortoise-orm - v0.15.20 (legacy)

Published by grigi over 4 years ago

  • Default values() & values_list() now includes annotations.
  • Annotations over joins now work correctly with values() & values_list()
  • Ensure GROUP BY precedes HAVING to ensure that filtering by aggregates work correctly.
  • Cast BooleanField values correctly on SQLite & MySQL
tortoise-orm - v0.16.1

Published by grigi over 4 years ago

  • QuerySetSingle now has better code completion

  • Created Pydantic models will now have the basic validation elements:

    • required is correctly populated for required fields
    • nullable is added to the schema where nulls are accepted
    • maxLength for CharFields
    • minimum & maximum values for integer fields

    To get Pydantic to handle nullable/defaulted fields correctly one should do a **user.dict(exclude_unset=True) when passing values to a Model class.

  • Added FastAPI helper that is based on the starlette helper but optionally adds helpers to catch and report with proper error DoesNotExist and IntegrityError Tortoise exceptions.

  • Allows a Pydantic model to exclude all read-only fields by setting exclude_readonly=True when calling pydantic_model_creator.

  • a Tortoise PydanticModel now provides two extra helper functions:

    • from_queryset: Returns a List[PydanticModel] which is the format that e.g. FastAPI expects
    • from_queryset_single: allows one to avoid calling await multiple times to get the object and all its related items.
tortoise-orm - v0.16.0

Published by grigi over 4 years ago

This release drops support for Python 3.6:
Tortoise ORM now requires a minimum of CPython 3.7

New features:

  • Model docstrings and #: comments directly preceding Field definitions are now used as docstrings and DDL descriptions.

    This is now cleaned and carried as part of the docstring parameter in describe_model(...)

    If one doesn't explicitly specify a Field description= or Model Meta.table_description= then we default to the first line as the description.
    This is done because a description is submitted to the DB, and needs to be short (depending on DB, 63 chars) in size.

  • Early Partial Init of models.

    We now have an early init of models, which can be useful when needing Models that are not bound to a DB, but otherwise complete.
    e.g. Schema generation without needing to be properly set up.

  • Pydantic serialisation.

    We now include native support for automatically building a Pydantic model from Tortoise ORM models.
    This will correctly model:

    • Data Fields
    • Relationships (FK/O2O/M2M)
    • Callables

    At this stage we only suport serialisation, not deserialisation.

    For mode information, please see :ref:contrib_pydantic

  • Allow usage of F expressions to in annotations. (#301)
  • Now negative number with limit(...) and offset(...) raise ParamsError. (#306)
  • Allow usage of Function to queryset.update(). (#308)
  • Add ability to supply distinct flag to Aggregate (#312)

Bugfixes:

  • Fix default type of JSONField

Removals:

  • Removed tortoise.aggregation as this was deprecated since 0.14.0

  • Removed start_transaction as it has been broken since 0.15.0

  • Removed support for Python 3.6 / PyPy-3.6, as it has been broken since 0.15.0

    If you still need Python 3.6 support, you can install tortoise-orm<0.16 as we will still backport critical bugfixes to the 0.15 branch for a while.

tortoise-orm - v0.15.19

Published by grigi over 4 years ago

0.15 series is now pseudo LTS (until May), as it is the last version to support Python3.6.

  • Fix Function with source_field option. (#311)
tortoise-orm - v0.15.18

Published by grigi over 4 years ago

  • Install on Windows does not require a C compiler any more.
  • Fix IntegrityError with unique field and get_or_create
tortoise-orm - v0.15.17

Published by grigi over 4 years ago

  • Now get_or_none(...), classmethod of Model class, works in the same way as queryset (#299)
tortoise-orm - v0.15.16

Published by grigi over 4 years ago

  • get_or_none(...) now raises MultipleObjectsReturned if multiple object fetched. (#298)
tortoise-orm - v0.15.15

Published by grigi over 4 years ago

  • Add ability to suppply a to_field= parameter for FK/O2O to a non-PK but still uniquely indexed remote field. (#287)
tortoise-orm - v0.15.14

Published by grigi over 4 years ago

  • add F expression support in queryset.update() - This allows for atomic updates of data in the database. (#294)
tortoise-orm - v0.15.13

Published by grigi over 4 years ago

  • Applies default ordering on related queries
  • Fix post-ManyToMany related queries not being evaluated correctly
  • Ordering is now preserved on ManyToMany related fetches
  • Fix aggregate function on joined table to use correct primary key (#292)
  • Fix filtering by backwards FK to use correct primary key
tortoise-orm - v0.15.12

Published by grigi over 4 years ago

  • Added range filter to support between and syntax
tortoise-orm -

Published by grigi over 4 years ago

  • Added ordering option for model Meta class to apply default ordering (#288)
tortoise-orm - v0.15.10

Published by grigi over 4 years ago

  • Bumped requirements to cater for newer feature use (#282)