December 26th, 2014, 12:57 PM
[PYTHON] MySQL insert into ...
So i have some code and how i can add into it mysql insert ?
def log(self, infohash, address=None):
stdger.debug("%s|%s:%s" % (infohash.encode("hex"), address, address))
fileger.debug('%s|%s:%s' % (infohash.encode('hex').upper(),address,address))
//here i need have mysql code to insert infohash.encode("hex") and address
if __name__ == "__main__":
#max_node_qsize bigger, bandwith bigger, spped higher
threads = 
December 27th, 2014, 10:49 AM
I'm aware of two choices. Your python code can write a mysql script that inserts the data, then run mysql as a separate task. That's how I'd solve the problem. The other choice: connect directly to mysql using the programmatic interface. There you'd logon, open the table making a "cursor", then you'd issue the insert into command using some method available to the cursor.
[/code] are essential for python code and Makefiles!