'Returns the SQL fragment used for the left-hand side of a column
constraint (for example, the "T1.foo" portion in the clause
"WHERE ... T1.foo = 6") and a list of parameters.'

def sql_for_columns(self, data, qn, connection, internal_type=None):

    (table_alias, name, db_type) = data
    if table_alias:
        lhs = ('%s.%s' % (qn(table_alias), qn(name)))
    else:
        lhs = qn(name)
    return (connection.ops.field_cast_sql(db_type, internal_type) % lhs)
