Generate dynamic SQL queries in node