MySQL

Indexes

MySQL specific indexes.

class tortoise.contrib.mysql.indexes.FullTextIndex(*expressions, fields=None, name=None, parser_name=None)[source]
class tortoise.contrib.mysql.indexes.SpatialIndex(*expressions, fields=None, name=None)[source]

Fields

MySQL specific fields.

class tortoise.contrib.mysql.fields.GeometryField(source_field=None, generated=False, pk=False, null=False, default=None, unique=False, index=False, description=None, model=None, validators=None, **kwargs)[source]
class tortoise.contrib.mysql.fields.UUIDField(binary_compression=True, **kwargs)[source]

UUID Field

This field can store uuid value, but with the option to add binary compression.

If used as a primary key, it will auto-generate a UUID4 by default.

binary_compression (bool):

If True, the UUID will be stored in binary format. This will save 6 bytes per UUID in the database. Note: that this is a MySQL-only feature. See https://dev.mysql.com/blog-archive/mysql-8-0-uuid-support/ for more details.

MySQL full text search.

class tortoise.contrib.mysql.search.SearchCriterion(*columns, expr, mode=None)[source]

Only support for CharField, TextField with full search indexes.