Hi, I am using pool_class=NullPool in create_engine. but the Connection is still not getting released immidiately after doing connection.close(). It is still getting released after 300 seconds. Can you pls let me know how to accomplish immediate release of Connection. I do not want to use connection pooling.
with sshtunnel.SSHTunnelForwarder(
('ssh.pythonanywhere.com'),
ssh_username='arguptaHello', ssh_password='******',
remote_bind_address=('arguptaHello.mysql.pythonanywhere-services.com', 3306)
) as tunnel:
port = str(tunnel.local_bind_port)
conn_addr = 'mysql+mysqlconnector://' + user + ':' + passwd + '@' + host + ':' + port + '/' + db
print("[SQL] Trying to connect to " + conn_addr)
#engine =create_engine(conn_addr, pool_recycle=280)
engine =create_engine(conn_addr,poolclass=NullPool,echo=True)
dbConnection = engine.connect()
try:
dbConnection.execute("DELETE FROM ******* where x=%s",(y,))
dbConnection.execute("INSERT INTO " + tblName +"(y,jsonm,status)"+ " VALUES (%s,%s,%s)",(id,json.dumps(final,default=str),status))
except Exception as e:
print(e)
finally:
dbConnection.close
dbConnection.close()
engine.dispose()