Why store _database in ThreadSafeDatabaseMetadata?
>At first I thought every request is default to master, then I found that if one request switch to slave, _database in User became slave, then if gevent switch to another greenlet with a new request, then User's database is default to slave.

Yeah, I think you're right actually, and the implementation needs a change. Originally the idea I had was to just make sure that binding was a thread-safe operation, and that within a running thread, a different thread cannot alter the db. But, as you indicate, it also makes sense to me to preserve the "default" db.

You can use your patch or you can try out this commit: 00498bfc073569a63cb30fa43d706fdcc3e14dc0
```python
class ThreadSafeDatabaseMetadata(Metadata):
    """
    Metadata class to allow swapping database at run-time in a multi-threaded
    application. To use:
    class Base(Model):
        class Meta:
            model_metadata_class = ThreadSafeDatabaseMetadata
    """
    def __init__(self, *args, **kwargs):
        # The database attribute is stored in a thread-local.
        self._database = None
        self._local = threading.local()
        super(ThreadSafeDatabaseMetadata, self).__init__(*args, **kwargs)

    def _get_db(self):
        return getattr(self._local, 'database', self._database)
    def _set_db(self, db):
        self._local.database = self._database = db
    database = property(_get_db, _set_db)
```
I'm using peewee with gevent, and try to use `ThreadSafeDatabaseMetadata` to make sure every request can set its db to master/slave.
Here is how I define my model.
```python
class User(Model):
    id = BigAutoField(primary_key=True)
    class Meta:
        database = master
        model_metadata_class = ThreadSafeDatabaseMetadata
```
At first I thought every request is default to master, then I found that if one request switch to slave, `_database` in `User` became slave, then if gevent switch to another greenlet with a new request, then User's database is default to slave.
Of course this can be solved by every request first call something like `master.bind([ALLMODELS])`, but if that so, why is `_database` necessary? Can I remove `_database` in `ThreadSafeDatabaseMetadata` and use like this?
```python
class ThreadSafeDatabaseMetadata(Metadata):
    def __init__(self, *args, **kwargs):
        # database attribute is stored in a thread-local.
        self._local = threading.local()
        super(ThreadSafeDatabaseMetadata, self).__init__(*args, **kwargs)

    def _get_db(self):
        return getattr(self._local, 'database', master) # default use master
    def _set_db(self, db):
        self._local.database = db
    database = property(_get_db, _set_db)
```
And I think `ThreadSafeDatabaseMetadata`'s behavior is a bit confusing, and didn't find it in the document.