[#956] Add support for storing logs in database.

Minor fixes in Twistar (to be reported upstream):

 * improperly placed import for mysqldb
 * need to fetch result set, otherwise MySQLDB connector will raise an exception