Connect Once, Query Lots (updated)
I had followed your examples and from that I had set it up so that all I had to do was pass my query to one function in an imported module and I would get back the sql result. That worked great until I wanted to run through a large csv file checking against the database and then writing results to another csv. I ended up opening and closing too many ports and hit the port limit, at which my script failed.
Since I do not have administrator access to change the number of ports or the wait time for the ports to become accessible, the only choice was to change my code. I know that I need to create one connection and then use it for several queries, instead of reconnecting everytime rapidly. I've tried two different approaches to integrating the mysqlconnector code into mine and each time I think I have everything ironed out I get :
TypeError: 'NoneType' object is not callable
I didn't see an example of where there was one function for the connection and one function for the queries and it seems a bit tricky to get that to work, but now I can't figure out how to work around this error.
Any help would be appreciated. Thanks!