Tortoise-orm

Latest version: v0.20.1

Safety actively analyzes 628924 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 16 of 23

0.12.4

Not secure
------
- Inherit fields from Mixins, together with abstract model classes.

0.12.3

Not secure
------
- Added description attribute to Field class. (124)
- Added the ability to leverage field description from (124) to generate table column comments and ability to add table level comments

0.12.2

Not secure
------
- Fix accidental double order-by for ``.values()`` based queries. (143)

0.12.1

Not secure
------
* Bulk insert operation:

.. note::
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,
this may result in incomplete references in Python.

e.g. ``IntField`` primary keys will not be populated.

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

.. code-block:: python3

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

- Notable efficiency improvement for regular inserts

0.12

====

0.12.0

Not secure
------
* Tortoise ORM now supports non-autonumber primary keys.

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

That 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.
That alias field can be used as a field name when doing filtering e.g. ``.filter(pk=...)`` etc…

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

.. code-block:: python3

IntField
BigIntField
CharField
UUIDField

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.

Any of these are valid primary key definitions in a Model:

.. code-block:: python3

id = fields.IntField(pk=True)

checksum = fields.CharField(pk=True)

guid = fields.UUIDField(pk=True)


.. rst-class:: emphasize-children

Page 16 of 23

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.