add exception for sql and add view template