MySQL Extensions
Peewee provides an alternate database implementation for using themysql-connector driver. Theimplementation can be found in playhouse.mysql_ext
.
Example usage:
- from playhouse.mysql_ext import MySQLConnectorDatabase
- # MySQL database implementation that utilizes mysql-connector driver.
- db = MySQLConnectorDatabase('my_database', host='1.2.3.4', user='mysql')
Additional MySQL-specific helpers:
- class
JSONField
- Extends
TextField
and implements transparent JSON encoding anddecoding in Python.
Match
(columns, expr[, modifier=None])
Parameters:
- columns – a single
Field
or a tuple of multiple fields. - expr (str) – the full-text search expression.
- modifier (str) – optional modifiers for the search, e.g. ‘in boolean mode’.
Helper class for constructing MySQL full-text search queries of the form:
- MATCH (columns, ...) AGAINST (expr[ modifier])