Re working sql connections

Moving the way sql connections are expressed in the templates