Closing MySQL Database and / or Model creation decorator
I prefer to keep model creation APIs as-is. Of course if you like using this function to create tables at module-load time then you could release it as a peewee extension. I prefer to avoid any import-time side-effects and APIs that promote them.
 Thanks for the feedback. But what about the first part of the patch regarding auto-closing MySQL connections?
Patch for 911833b1b08a44041cf99cdc76117adec1a6832b

```
3473a3474,3479
>     def execute_sql(self, sql, params=None, require_commit=True):
>         """Executes an SQL query with an explicit connection"""
>         with self.execution_context():
>             return super(MySQLDatabase, self).execute_sql(
>                 sql, params=params, require_commit=require_commit)
> 
```

Hi coleifer,

I am working with peewee now for some time - mostly with MySQL databases - and have encountered several problems regarding the lack of automatic closing of database connections, particularly Error 2006 as described here: http://peewee.readthedocs.org/en/latest/peewee/database.html#using-mysql
I have modified the `peewee.MySQLDatabase` accordingly to always use execution contexts when handling queries.
This resolved the aforementioned issue for me and I do not need to worry about connection management (which is unlikely what you want to do when using an ORM).
Additionally I added a module-level function to be used as a decorator to create modules automatically on loading their respective module.
Below you'll find the patch for commit 911833b1b08a44041cf99cdc76117adec1a6832b

```
29a30
> from contextlib import suppress
3473a3475,3480
>     def execute_sql(self, sql, params=None, require_commit=True):
>         """Executes an SQL query with an explicit connection"""
>         with self.execution_context():
>             return super(MySQLDatabase, self).execute_sql(
>                 sql, params=params, require_commit=require_commit)
> 
4159a4167,4181
> 
> 
> def create(model):
>     """Decorator for peewee.Model definitions that
>     actually should be created on load.
> 
>     Usage:
>         @create
>         class MyModel(peewee.Model):
>             pass
>     """
>     with suppress(OperationalError):
>         with model._meta.database.execution_context():
>             model.create_table(fail_silently=True)
>     return model
```

I'd be glad if you consider my patch for upstream or give me some feedback why you wouldn't.

Cheers

Richard alias coNQP
