adding sql templates and generation to mytrilogy