[Tutor] Source of MySQL Command Interpreter

Peter Otten __peter__ at web.de
Sun Jan 17 11:27:42 EST 2016


Ricardo Martínez wrote:

> Hi, i wrote a small APP to execute MySQL commands and retrieve to a
> Treeview
> 
> http://pastebin.com/v2C8kAu1
> 
> Share your comments and upgrades.

Well, you have an application that works -- that's good. 
Do you have specific questions in mind? Then don't hesitate to ask.
Lacking that I can only give some general remarks:

(1) Read PEP8 and consider following it with your code.

(2) Write unittests to ensure that things that currently work keep working.

(3) Check code coverage to ensure that there is no dead code and no untested 
code.

(4) Consider dropping star imports like

from tkinter import *

in favour of

import tkinter as tk

or at least

from tkinter import name1, ..., nameN 

(5) You have one big do-it-all class. Some modularization would probably be 
good. To avoid modularizing into the blue I suggest that you write a version 
of your script that works with SQLite or PostgreSQL, and aim to put as much 
of the code into helper modules that can be used by both versions of your 
application.



More information about the Tutor mailing list