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 visible (Hide)

tortoise-orm - 0.17.2

Published by long2ice over 3 years ago

  • Add more index types.
  • Add force_index, use_index to queryset.
  • Fix F in update error with update_fields.
  • Make delete query work with limit and order_by. (#697)
  • Filter backward FK fields with IS NULL and NOT IS NULL filters (#700)
  • Add select_for_update in update_or_create. (#702)
  • Add Model.select_for_update.
  • Add __search full text search to queryset.
tortoise-orm - 0.17.1

Published by long2ice over 3 years ago

  • Fix type for modules.
  • Fix select_related when related model specified more than once. (#679)
  • Add __iter__ to model, now can just return model/models in fastapi response.
  • Fix in_transaction bug caused by router. (#677) (#678)
tortoise-orm - 0.17.0

Published by long2ice over 3 years ago

  • Add date part extract filtering.
  • Add Manager support.
  • Add db router support.
  • Add nowait, skip_locked, of parameters to queryset.select_for_update.
  • Add field name to validation exceptions.
  • Compatible with asyncmy.
  • Replace pypika to pypika-tortoise.
tortoise-orm - 0.16.21

Published by long2ice over 3 years ago

  • Fixed validating JSON before decoding. (#623)
  • Add model method update_or_create.
  • Add batch_size parameter for bulk_create method.
  • Fix save with F expression and field with source_field.
tortoise-orm - 0.16.20

Published by long2ice over 3 years ago

  • Add model field validators.
  • Allow function results in group by. (#608)
tortoise-orm - 0.16.19

Published by abondar almost 4 years ago

  • Replace set TZ environment variable to TIMEZONE to avoid affecting global timezone.
  • Allow passing module objects to models_paths param of Tortoise.init_models(). (#561)
  • Implement PydanticMeta.backward_relations. (#536)
  • Allow overriding PydanticMeta in PydanticModelCreator. (#536)
  • Fixed make_native typo to make_naive in timezone module
tortoise-orm - 0.16.18

Published by long2ice almost 4 years ago

  • Support custom function in update. (#537)
  • Add Model.refresh_from_db. (#549)
  • Add timezone support, be careful to upgrade to this version, see docs for details. (#335)
  • Remove aerich in case of cyclic dependency. (#558)
tortoise-orm - 0.16.17

Published by long2ice almost 4 years ago

  • Add on_delete in ManyToManyField. (#508)
  • Support F expression in annotate. (#475)
  • Fix QuerySet.select_related in case of join same table twice. (#525)
  • Integrate Aerich into the install. (#530)
tortoise-orm - 0.16.16

Published by abondar about 4 years ago

  • Fixed inconsistency in integrity error exception of FastAPI
  • add OSError to _get_comments except block
tortoise-orm - v0.16.15

Published by long2ice about 4 years ago

  • Make DateField accept valid date str.
  • Add QuerySet.select_for_update().
  • check default for not None on pydantic model creation
  • propagate default to pydantic model
  • Add QuerySet.select_related().
  • Add custom attribute name for Prefetch instruction.
  • Add db_constraint for RelationalField family.
tortoise-orm - v0.16.14

Published by grigi about 4 years ago

  • We now do CI runs on a Windows VM as well, to try and prevent Windows specific regressions.
  • Make F expression work with QuerySet.filter().
  • Include py.typed in source distribution.
  • Added datetime parsing from int for fields.DatetimeField.
  • get_or_create passes the using_db= on if provided.
  • Allow custom loop and connection_class parameters to be passed on to asyncpg.
tortoise-orm - v0.16.13

Published by grigi over 4 years ago

  • Default install of tortoise-orm now installs with no C-dependencies, if you want to use the C accelerators, please do a pip install tortoise-orm[accel] instead.
  • Added <instance>.clone() method that will create a cloned instance in memory. To persist it you still need to call .save()
  • .clone() will raise a ParamsError if tortoise can't generate a primary key. In that case do a .clone(pk=<newval>)
  • If manually setting the primary key value to None and the primary key can be automatically generated, this will create a new record. We however still recommend the .clone() method instead.
  • .save() can be forced to do a create by setting force_create=True
  • .save() can be forced to do an update by setting force_update=True
  • Setting update_fields for a .save() operation will strongly prefer to do an update if possible
tortoise-orm - v0.16.12

Published by grigi over 4 years ago

  • Make Field.default effect on db level when generate table
  • Add converters instead of importing from pymysql
  • Fix PostgreSQL BooleanField default value convertion
  • Fix JSONField typed in pydantic_model_creator
  • Add .sql() method on QuerySet
tortoise-orm - v0.16.11

Published by grigi over 4 years ago

  • fix: sqlite://:memory: in Windows thrown OSError: [WinError 123]
  • Support bulk_create() insertion of records with overridden primary key when the primary key is DB-generated
  • Add queryset.exists() and Model.exists().
  • Add model subscription lookup, Model[<pkval>] that will return the object or raise KeyError
tortoise-orm - v0.16.10

Published by grigi over 4 years ago

  • Fix bad import of basestring
  • Better handling of NULL characters in strings. Fixes SQLite, raises better error for PostgreSQL.
  • Support .group_by() with join now
tortoise-orm - v0.16.9

Published by grigi over 4 years ago

  • Support F expression in .save() now
  • IntEnumField accept valid int value and CharEnumField accept valid str value
  • Pydantic models get created with globally unique identifier
  • Leaf-detection to minimize duplicate Pydantic model creation
  • Pydantic models with a Primary Key that is also a raw field of a relation is now not hidden when exclude_raw_fields=True as it is a critically important field
  • Raise an informative error when a field is set as nullable and primary key at the same time
  • Foreign key id's are now described to have the positive-integer range of the field it is related to
  • Fixed prefetching over OneToOne relations
  • Fixed __contains for non-text fields (e.g. JSONB)
tortoise-orm - v0.16.8

Published by grigi over 4 years ago

  • Allow Q expression to function with _filter parameter on aggregations
  • Add manual .group_by() support
  • Fixed regression where GROUP BY class is missing for an aggregate with a specified order.
tortoise-orm - v0.15.24

Published by grigi over 4 years ago

  • Fixed regression where GROUP BY class is missing for an aggregate with a specified order.
tortoise-orm - v0.16.7

Published by grigi over 4 years ago

  • Added preliminary support for Python 3.9
  • TruncationTestCase now properly quotes table names when it clears them out.
  • Add model signals support
  • Added app_label to test initializer(...) and TORTOISE_TEST_APP as test environment variable.
tortoise-orm - v0.16.6

Published by grigi over 4 years ago

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

Security fixes:

  • 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)

Other changes:

  • Added support for partial models:

    To create a partial model, one can do a .only(<fieldnames-as-strings>) as part of the QuerySet.
    This will create model instances that only have those values fetched.

    Persisting changes on the model is allowed only when:

    • All the fields you want to update is specified in <model>.save(update_fields=[...])
    • You included the Model primary key in the `.only(...)``

    To protect against common mistakes we ensure that errors get raised:

    • If you access a field that is not specified, you will get an AttributeError.
    • If you do a <model>.save() a IncompleteInstanceError will be raised as the model is, as requested, incomplete.
    • If you do a <model>.save(update_fields=[...]) and you didn't include the primary key in the .only(...),
      then IncompleteInstanceError will be raised indicating that updates can't be done without the primary key being known.
    • If you do a <model>.save(update_fields=[...]) and one of the fields in update_fields was not in the .only(...),
      then IncompleteInstanceError as that field is not available to be updated.
  • Fixed bad SQL generation when doing a .values() query over a Foreign Key
  • Added <model>.update_from_dict({...}) that will mass update values safely from a dictionary
  • Fixed processing URL encoded password in connection string