Forums

ssh slowness

I've set up a simple MySQL database at pythonanywhere and can insert data. My goal is to add rows to the database with a handful of fields from my website.

I created a sample Python program to add rows as a test before deploying on my website. I can only get it to work reliably if I set the SSH_TIMEOUT and TUNNEL_TIMEOUT to 20. That's too slow. I may need to add one or more row per second. Is there something I can do to speed it up or am I trying to use the wrong tool?

Thanks!

How are you adding those rows? Do you create connection for each one of them or are you adding the rows after establishing the connection?

Hi, thank you for your response. Here's my code:

email_address='test@abc.com'
name='Joe Smith'
city='New York'
cursor=connection.cursor()
sql='INSERT INTO Userdata (email,name,city) VALUES (%s, %s, %s)'
val=(email_address,name,city)
cursor.execute(sql,val)
connection.commit()

We have had some issues with the SSH server over the last few days. We have identified the problem and fixed it so let us know if it still appears to be slow.

It's working much better now, thanks!

Great! Thanks for letting us know.