JBecquer / KC-Flying-Club-Plane-Tracker

Generate a map of FCKC airplane tracks.
MIT License
0 stars 0 forks source link

Reduce unnecessary calls to the database #9

Closed JBecquer closed 1 year ago

JBecquer commented 2 years ago

Every time we work on a new aircraft or push/pull data we are reconnecting to MySQL.

Instead we can update our mycursor.execute commands to reference the schema we want to manipulate, rather than re-connecting every time.

example: FROM mycursor.execute(f"SELECT date FROM fleet WHERE aircraft = \"{aircraft}\"") TO mycursor.execute(f"SELECT date FROM date_last_ran.fleet WHERE aircraft = \"{aircraft}\"")

and remove the database line of mysql_connect

JBecquer commented 2 years ago

Will need to scrub for db.close() and move that command to our code exit conditions

JBecquer commented 1 year ago

Tabled for now because this would take a fair bit of reworking to the code and how mysql_connect() interacts with all of the various functions. Will monitor run times moving forward and evaluate as needed.