Usage in a replicated Postgres cluster
Not really, no, it's kind-of up to you how you want to handle that. It's not something that is "officially" supported, although there are ways you can do it, as you allude to. I'm not sure what would be making it sporadically fail under-load, either - that seems odd if it works correctly under general circumstances. I don't have enough information to really debug if this even points to the existence of a bug.
Hi, I'm using Peewee in prod and recently we set up a read replica.

As far as I've seen in the issues and the doc, there is no support to specify a `database` that could be used for read-only queries.

I'm using this piece of code for dynamic database binding at run-time since a few months, but under some load (gevent + gunicorn), I get errors linked to Inserts/Updates being done in a Read Only connection if I have a read replica:

```python
from playhouse.pool import PooledPostgresqlExtDatabase
leader_db = PooledPostgresqlExtDatabase(...)

if config.db.read_replica is not None:
    read_replica = PooledPostgresqlExtDatabase(...)
    


def using_db(db, *models):
    """Decorator used to specify the db to use, binds the models to the given db before querying"""

    def using_db_decorator(f):
        @wraps(f)
        def wrapper(*args, **kwargs):
            [m.bind(db) for m in models]
            try:
                db.connect(reuse_if_open=True)
                return f(*args, **kwargs)
            finally:
                db.close()

        return wrapper

    return using_db_decorator
```

And I'm using the `using_db` as a decorator over my persistence functions:
```python
class AuthToken(Model):
    id = AutoField(primary_key=True)
    value = CharField(null=False, index=True)
    created_at = DateTimeField(null=False, default=datetime.now)
    last_used_at = DateTimeField(null=False, default=datetime.now)

@using_db(leader_db, AuthToken)
def update(id: int, last_used_at: datetime) -> Optional[AuthToken]:
    return AuthToken.update(last_used_at=last_used_at).where(AuthToken.id == id).returning(AuthToken).execute()[0]
```


It _can_ trigger this kind of error:
```
ReadOnlySqlTransaction
cannot execute UPDATE in a read-only transaction
```

So, Do you have guidance on how to use Peewee with a replicated Postgres system?