December 26th, 2014, 11:57 AM
[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, 09: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!