extraneous sort in print_query
extraneous sort in print_query

Alternatively, print in sorted order, e.g.

def print_table(D):
    K = D.keys()
    K.sort()
    n = max(map(len, K)) # Length of longest key
    for k in K:
        print("%*s = %s" % (-n, k, D[k]))
ECP-CANDLE/Database,ECP-CANDLE/Database