Database connection not refreshed after wait_timeout
You need to close connections when you're done with them. Neither pymysql nor peewee will detect the 2013/2006 error and re-connect automatically.
 If you're using the connection pool, then when you close a connection it will be returned to the pool and recycled until it reaches it's stale timeout (specified when initializing the pool).

``` python

db = PooledMySQLDatabase('my_db', stale_timeout=300)  # Consider a conn stale after 5 mins.

db.connect()
# do some stuff.
db.close()  # Return connection to the pool.
```
 Ok. I didn't realize I had to manually connect and close database connections. That makes sense. Thanks a lot!

I do realize this is a very newbie kind of problem, but maybe you could put some more emphasis on this in the documentation - possibly in the quickstart section.

Anyways, thanks for the great ORM! Your work is very much appreciated!
 Yeah, while I have added some documentation to this effect, it could certainly stand to be improved. You're not the first person to find this confusing, so I'll make a point to clean up the docs.
 ![s1419837109 48](https://cloud.githubusercontent.com/assets/119974/5566767/fd8aa9a2-8ef7-11e4-96e3-e1e505e3dde8.png)
 Explicitly putting the db.connect() and db.close() statements in some example code might help make the point clear. I noticed that this is shown in the "Example app" page in the documentation. But, I hadn't read it until now, because I use cherrypy and I thought the "Example app" page was flask specific and not relevant to me. I was mostly going through the "API Reference", "Managing your Database" and "Quickstart" sections of the documentation to try and figure out what had happened.
 good idea

I'm using peewee with a MySQL database with pymysql being the database driver. The wait_timeout of my mysql database is set to the default value of 8 hours.

When my application remains idle for 8 hours, the database connection times out, and any further requests throw MySQL errors 2013 (Lost connection to MySQL server during query) and 2006 (MySQL server has gone away). Similar behaviour also happens with PooledMySQLDatabase connections.

Is this behaviour normal? Should I do something to make peewee to reconnect timed out connections, or is pymysql supposed to take care of this?
