So i have some code and how i can add into it mysql insert ? class Master(object): def log(self, infohash, address=None): stdger.debug("%s|%s:%s" % (infohash.encode("hex"), address[0], address[1])) fileger.debug('%s|%s:%s' % (infohash.encode('hex').upper(),address[0],address[1])) //here i need have mysql code to insert infohash.encode("hex") and address[0] into mysql database if __name__ == "__main__": #max_node_qsize bigger, bandwith bigger, spped higher initialLog() threads = []
Have you had a look at the example on the mysql website? http://dev.mysql.com/doc/connector-python/en/connector-python-example-cursor-transaction.html