persistent connection mysqlDb python

0

Because of having to be opening and closing database connection memory consumption goes up? I would like to know if I use an open connection at all times, I will have the advantage of decreasing memory consumption.

import MySQLdb

dblocal = MySQLdb.connect("host",
                        "user",
                        "password", 
                        "db")

cursor = dblocal.cursor()
cursor.execute("SELECT * FROM ("tabela")
recordsdblocal = cursor.fetchall()

If it is possible and feasible how can I do this?

    
asked by anonymous 01.08.2018 / 06:07

0 answers