Added debug messages to sql.py