Module Expr Str ImportFrom alias ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body If UnaryOpNot Call NameLoad AttributeLoad NameLoad attr Str NameLoad body Return AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call NameLoad NameLoad Str Num Assign AttributeStore NameLoad attr BinOpMod BinOpAdd NameLoad Num Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr Return SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam defaults vararg kwarg body Assign NameStore Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Return NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults vararg kwarg body Assign NameStore Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad If Call AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr attr Str body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Return NameLoad decorator_list NameLoad decorator_list
N/A N/A 
Support for using a dedicated read-slave. The read database is specified as a
Model.Meta option, and will be used for SELECT statements:


master = PostgresqlDatabase('master')
read_slave = PostgresqlDatabase('read_slave')

class BaseModel(ReadSlaveModel):
    class Meta:
        database = master
        read_slaves = [read_slave]  # This database will be used for SELECTs.


# Now define your models as you would normally.
class User(BaseModel):
    username = CharField()

# To force a SELECT on the master database, you can instantiate the SelectQuery
# by hand:
master_select = SelectQuery(User).where(...)
 peewee * ReadSlaveModel N/A Model N/A _get_read_database N/A N/A cls N/A N/A N/A N/A N/A getattr N/A cls _meta read_slaves None N/A N/A N/A N/A cls _meta database N/A current_idx N/A getattr cls _read_slave_idx -1 N/A N/A cls _read_slave_idx N/A N/A current_idx 1 N/A len N/A N/A cls _meta read_slaves N/A N/A N/A N/A cls _meta read_slaves N/A N/A cls _read_slave_idx N/A classmethod select N/A N/A cls N/A args kwargs N/A N/A query N/A N/A N/A super ReadSlaveModel cls select args kwargs N/A N/A query database N/A N/A cls _get_read_database N/A query N/A classmethod raw N/A N/A cls N/A args kwargs N/A N/A query N/A N/A N/A super ReadSlaveModel cls raw args kwargs N/A N/A N/A N/A N/A N/A query _sql lower startswith select N/A N/A N/A query database N/A N/A cls _get_read_database N/A query N/A classmethod N/A