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 - v0.13.5

Published by grigi about 5 years ago

  • Sample Starlette integration
  • Relational fields are now lazily constructed via properties instead of in the constructor,
    this results in a significant overhead reduction for Model instantiation with many relationships.
tortoise-orm - v0.13.4

Published by grigi about 5 years ago

  • Assigning to the FK field will correctly set the associated db-field
  • Reading a nullalble FK field can now be None
  • Nullalble FK fields reverse-FK is now also nullable
  • Deleting a nullable FK field sets it to None
tortoise-orm - v0.13.3

Published by grigi about 5 years ago

  • Fixed installing Tortoise-ORM in non-unicode systems. (#180)
  • «queryset».update(…) now correctly uses the DB-specific to_db_value()
  • fetch_related(…) now correctly encodes non-integer keys.
  • ForeignKey fields of type UUIDField are now escaped consistently.
  • Pre-generated ForeignKey fields (e.g. UUIDField) is now checked for persistence correctly.
  • Duplicate M2M .add(…) now checks using consistent field encoding.
  • source_field Fields are now handled correctly for ordering.
  • source_field Fields are now handled correctly for updating.
tortoise-orm - v0.13.2

Published by grigi about 5 years ago

  • Security fixes for «model».save() & «model».dete():
    This is now fully parametrized, and these operations are no longer susceptible to escaping issues.

  • Performance improvements:

    • Simple update is now ~3-6× faster
    • Partial update is now ~3× faster
    • Delete is now ~2.7x faster
  • Fix generated Schema Primary Key for BigIntField for MySQL and PostgreSQL.
  • Added support for using a SmallIntField as a auto-gen Primary Key.
  • Ensure that default PK is added to the top of the attrs.
tortoise-orm - v0.13.1

Published by grigi about 5 years ago

  • Model schema now has a discovery API:

    One can call Tortoise.describe_models() or Tortoise.describe_model(<Model>) to get
    a full description of the model(s).

    Please see tortoise.Tortoise.describe_model and tortoise.Tortoise.describe_models for more info.

  • Fix in generating comments for Foreign Keys in MySQL
  • Added schema support for PostgreSQL. Either set "schema": "custom" var in credentials or as a query parameter ?schema=custom
  • Default MySQL charset to utf8mb4. If a charset is provided it will also force the TABLE charset to the same.
tortoise-orm - v0.13.0

Published by grigi about 5 years ago

Warning:

This release brings with it, deprecation of Python 3.5

We will increase the minimum supported version of Python to 3.6, as 3.5 is reaching end-of-life,
and is missing many useful features for async applications.

We will discontinue Python 3.5 support on the next major release (Likely 0.14.0)

New Features:

  • Example Sanic integration along with register_tortoise hook in contrib (#163)
  • .values() and .values_list() now default to all fields if none are specified.
  • generate_schema() now generates well-formatted DDL SQL statements.
  • Added TruncationTestCase testing class that truncates tables to allow faster testing of transactions.
  • Partial saves are now supported (#157): obj.save(update_fields=['model','field','names'])

Bugfixes:

  • Fixed state leak between database drivers which could cause incorrect DDL generation.
  • Fixed missing table/column comment generation for ForeignKeyField and ManyToManyField
  • Fixed comment generation to escape properly for SQLite
  • Fixed comment generation for PostgreSQL to not duplicate comments
  • Fixed generation of schema for fields that defined custom source_field values defined
  • Fixed working with Models that have fields with custom source_field values defined
  • Fixed safe creation of M2M tables for MySQL dialect (#168)

Docs/examples:

  • Examples have been reworked:
    • Simplified init of many examples
    • Re-did generate_schema.py example
    • A new relations_recirsive.py example (turned into test case)
  • Lots of small documentation cleanups
tortoise-orm - v0.12.8

Published by grigi about 5 years ago

Re-release of v0.12.6 due to a regression in v0.12.7

tortoise-orm - v0.12.7 (Known broken, please don't use)

Published by grigi about 5 years ago

  • Support connecting to PostgreSQL via Unix domain socket (simple case).
  • Self-referential Foreign and Many-to-Many keys are now allowed
tortoise-orm - v0.12.6

Published by grigi about 5 years ago

  • Handle a __models__ variable within modules to override the model discovery mechanism:
    If you define the __models__ variable in yourapp.models (or wherever you specify to load your models from),
    generate_schema() will use that list, rather than automatically finding all models for you.
  • Split model consructor into from-Python and from-DB paths, leading to 15-25% speedup for large fetch operations.
  • More efficient queryset manipulation, 5-30% speedup for small fetches.
tortoise-orm - v0.12.5

Published by grigi over 5 years ago

  • Using non registered models or wrong references causes an ConfigurationError with a helpful message.
  • make check returns better error message on black errors.
tortoise-orm - v0.12.4

Published by grigi over 5 years ago

  • Inherit fields from Mixins, together with abstract model classes. (#147)
tortoise-orm - v0.12.3

Published by grigi over 5 years ago

  • Added description attribute to Field class. (#124)
  • Added the ability to leverage field description to generate table column comments and ability to add table level comments (#148 #149)
tortoise-orm - v0.12.2

Published by grigi over 5 years ago

  • Fix accidental double order-by for based queries. (#143)
tortoise-orm - v0.12.1

Published by grigi over 5 years ago

Bulk insert operation

The bulk insert operation will do the minimum to ensure that the object created in the DB has all the defaults and generated fields set, but may be incomplete reference in Python.

e.g. IntField primary keys will not be poplulated.

This is recommend only for throw away inserts where you want to ensure optimal insert performance.

User.bulk_create([
    User(name="...", email="..."),
    User(name="...", email="...")
])

Also: Notable efficiency improvement for regular inserts

tortoise-orm - v0.12.0

Published by grigi over 5 years ago

Tortoise ORM now supports non-autonumber primary keys.

This is a big feature change. It should not break any existing implementations.

We currently support single (non-composite) primary keys of any indexable field type, but only these field types are recommended:

  • IntField
  • BigIntField
  • CharField
  • UUIDField

The primary key will be accessible through a reserved field pk which will be an alias of whichever field has been nominated as a primary key.
The alias field can be used as a field name when doing filtering e.g. .filter(pk=...) etc...

One must define a primary key by setting a pk parameter to True.
If you don't define a primary key, we will create a primary key of type IntField with name of id for you.

tortoise-orm - v0.11.13

Published by grigi over 5 years ago

  • Fixed connection retry to work with transactions
  • Added broader PostgreSQL connection failure detection
tortoise-orm - v0.11.12

Published by grigi over 5 years ago

  • Added automatic PostgreSQL connection retry
tortoise-orm - v0.11.11

Published by grigi over 5 years ago

  • Extra parameters now get passed through to the MySQL & PostgreSQL drivers
tortoise-orm - v0.11.10

Published by grigi over 5 years ago

  • Fixed SQLite handling of DatetimeField (#130)
tortoise-orm - v0.11.9

Published by grigi over 5 years ago

  • Code has been reformatted using black, and minor code cleanups (#120 #123)
  • Sample Quart integration (#121)
  • Better isolation of connection handling — Allows more dynamic connections so we can do pooling & reconnections.
  • Added automatic MySQL connection retry