def prettifysql ( sql ) : pretty = [ ] for line in sql . split ( '\n' ) : pretty . extend ( [ "%s,\n" % x for x in line . split ( ',' ) ] ) return pretty
how do you format sql in python
Returns a prettified version of the SQL as a list of lines to help in creating a useful diff between two SQL statements .
def prettifysql(sql):
    """Returns a prettified version of the SQL as a list of lines to help
    in creating a useful diff between two SQL statements."""
    pretty = []
    for line in sql.split('\n'):
        pretty.extend(["%s,\n" % x for x in line.split(',')])
    return pretty