gen_sql for compiler