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.9

Published by grigi over 4 years ago

  • Alias Foreign Key joins as we can have both self-referencing and duplicate joins to the same table.
    This generates SQL that differentiates between which instance of the table to work with. (#275)
tortoise-orm - v0.15.8

Published by grigi almost 5 years ago

  • TextField now recommends usage of CharField if wanting unique indexing instead of just saying "indexing not supported"
  • .count() now honours offset and limit (#167)
  • Testing un-awaited ForeignKeyField as a boolean expression will automatically resolve as False if it is None (#274)
  • Awaiting a nullable ForeignKeyField won't touch the DB if it is None (#274)
tortoise-orm - v0.15.7

Published by grigi almost 5 years ago

  • QuerySet.Update() now returns the count of the no of rows affected. Note, that
  • QuerySet.Delete() now returns the count of the no of rows deleted.
  • Note that internal API of db_connection.execute_query() now returns rows_affected, results. (This is informational only)
  • Added get_or_none(...) as syntactic sugar for filter(...).first()
tortoise-orm - v0.15.6

Published by grigi almost 5 years ago

  • Added BinaryField for storing binary objects (bytes).
  • Changed TextField to use LONGTEXT for MySQL to allow for larger than 64KB of text.
  • De-duplicate index if specified on both index=true and as part of indexes
  • Primary Keyed TextField is marked as deprecated.
    We can't guarnatee that it will be properly indexed or unique in all cases.
  • One can now disable the backwards relation for FK/O2O relations by passing related_name=False
  • One can now pass a PK value to a generated field, and Tortoise ORM will use that as the PK as expected.
    This allows one to have a model that has a autonumber PK, but setting it explicitly if required.
tortoise-orm - v0.15.5

Published by grigi almost 5 years ago

  • Refactored Fields:

    Fields have been refactored, for better maintenance. There should be no change for most users.

    • More accurate auto-completion.
    • Fields now contain their own SQL schema by dialect, which significantly simplifies adding field types.
    • describe_model() now returns the DB type, and dialect overrides.
  • JSONField will now automatically use python-rapidjson as an accelerator if it is available.
  • DecimalField and aggregations on it, now behaves much more like expected on SQLite (#256)
  • Check whether charset name is valid for the MySQL connection (#261)
  • Default DB driver parameters are now applied consistently, if you use the URI schema or manual.
tortoise-orm - v0.15.4

Published by grigi almost 5 years ago

  • Don't generate a schema if there is no models (#254)
  • Emit a RuntimeWarning when a module has no models to import (#254)
  • Allow passing in a custom SSL context (#255)
tortoise-orm - 0.15.3

Published by grigi almost 5 years ago

  • Added OneToOneField implementation:

    OneToOneField describes a one to one relation between two models.
    It can be set from the primary side only, but resolved from both sides in the same way.

    describe_model(...) now also reports OneToOne relations in both directions.

    Usage example:

     event: fields.OneToOneRelation[Event] = fields.OneToOneField(
         "models.Event", on_delete=fields.CASCADE, related_name="address"
     )
    
  • Prefetching is done concurrently now, sending all prefetch requests at the same time instead of in sequence.
  • Enabe foreign key enforcement on SQLite for builds where it was optional.
tortoise-orm - v0.15.2

Published by grigi almost 5 years ago

  • The auto_now_add argument of DatetimeField is handled correctly in the SQLite backend. (#248)
  • unique_together now creates named constrains, to prevent the DB from auto-assigning a potentially non-unique constraint name. (#237)
  • Filtering by an auto_now field doesn't replace the filter value with now() anymore. (#249)
tortoise-orm - v0.15.1

Published by grigi almost 5 years ago

  • Handle OR'ing a blank Q() correctly (#240)
tortoise-orm - v0.15.0

Published by grigi almost 5 years ago

New features:

  • Pooling has been implemented, allowing for multiple concurrent databases and all the benefits that comes with it.
    • Enabled by default for databases that support it (mysql and postgres) with a minimum pool size of 1, and a maximum of 5
    • Not supported by sqlite
    • Can be changed by passing the minsize and maxsize connection parameters
  • Many small performance tweaks:
    • Overhead of query generation has been reduced by about 6%
    • Bulk inserts are ensured to be wrapped in a transaction for >50% speedup
    • PostgreSQL prepared queries now use a LRU cache for significant >2x speedup on inserts/updates/deletes
  • DateField & DatetimeField deserializes faster on PostgreSQL & MySQL.
  • Optimized .values() to do less copying, resulting in a slight speedup.
  • One can now pass kwargs and Q() objects as parameters to Q() objects simultaneously.

Bugfixes:

  • indexes will correctly map the foreign key if referenced by name.
  • Setting DB generated PK in constructor/create generates exception instead of silently being ignored.

Deprecations:

  • start_transaction is deprecated, please use @atomic() or async with in_transaction(): instead.

  • This release brings with it, deprecation of Python 3.6 / PyPy-3.6:

    This is due to small differences with how the backported aiocontextvars behaves
    in comparison to the built-in in Python 3.7+.

    There is a known context confusion, specifically regarding nested transactions.

tortoise-orm - v0.14.2

Published by grigi almost 5 years ago

  • A Field name of alias is now no longer reserved.
  • Restored support for inheriting from Abstract classes. Order is now also deterministic,
    with the inherited classes' fields being placed before the current.
tortoise-orm - v0.14.1

Published by grigi almost 5 years ago

  • ManyToManyField is now a function that has the type of the relation for autocomplete,
    this allows for better type hinting at less effort.
  • Added section on adding better autocomplete for relations in editors.
tortoise-orm - v0.14.0

Published by grigi almost 5 years ago

Caution:

This release drops support of Python 3.5:
Tortoise ORM now requires a minimum of CPython 3.6 or PyPy3.6-7.1

Enhancements:

  • Models, Fields & QuerySets have significant type annotation improvements,
    leading to better IDE integration and more comprehensive static analysis.
  • Fetching records from the DB is now up to 25% faster.
  • Database functions Trim(), Length(), Coalesce(), Lower(), Upper() added to tortoise.functions module.
  • Annotations can be selected inside Queryset.values() and Queryset.values_list() expressions.
  • Added support for Python 3.8
  • The Foreign Key property is now await-able as long as one didn't populate it via .prefetch_related()
  • One can now specify compound indexes in the Meta: class using indexes. It works just like unique_toghether.

Bugfixes:

  • The generated index name now has significantly lower chance of collision.
  • The compiled SQL query contains HAVING and GROUP BY only for aggregation functions.
  • Fields for FK relations are quoted properly.
  • Fields are quoted properly in UNIQUE statements.
  • Fields are quoted properly in KEY statements.
  • Comment Fields are quoted properly in PostgreSQL dialect.
  • unique_together and indexes will correctly map the foreign key if referenced by name.

Deprecations:

  • import from tortoise.aggregation is deprecated, please do import from tortoise.functions instead.

Breaking Changes:

  • The hash used to make generated indexes unique has changed.
    The old algorithm had a very high chance of collisions,
    the new hash algorithm is much better in this regard.
  • Dropped support for Python 3.5
tortoise-orm - v0.13.12

Published by grigi about 5 years ago

  • Reverted "The Field class now calls super().__init__, so mixins are properly initialised." as it was causing issues on Python 3.6.
tortoise-orm - v0.13.11

Published by grigi about 5 years ago

  • Fixed the _FieldMeta class not to checking if the 1st base class was Field, so would break with mixins.
  • The Field class now calls super().__init__, so mixins are properly initialised.
tortoise-orm - v0.13.10

Published by grigi about 5 years ago

  • Names ForeignKey constraints in a consistent way
tortoise-orm - v0.13.9

Published by grigi about 5 years ago

  • Fields can have 2nd base class which makes IDEs know python type (str, int, datetime...) of the field.
  • The type parameter of Field.__init__ is removed, instead we use the 2nd base class
  • Foreign keys and indexes are now defined correctly in MySQL so that they take effect as expected
  • MySQL now doesn't warn of unsafe index creation anymore
  • Support alternate MySQL DB engines, such as MyISAM
tortoise-orm - v0.13.8

Published by grigi about 5 years ago

  • Fixed bug in schema creation for MySQL where non-integer Primary-Keys did not get declared properly (#195)
tortoise-orm - v0.13.7

Published by grigi about 5 years ago

  • __iexact filter modifier was implemented. Queries like «queryset».filter(name__iexact=...) will perform case-insensitive search.
tortoise-orm - v0.13.6

Published by grigi about 5 years ago

  • Fix minor bug in Model.__init__ where we raise the wrong error on setting RFK/M2M values directly.
  • Fields in Queryset.values_list() is now in the defined Model order.
  • Fields in Queryset.values() is now in the defined Model order.