ENH: add schema support to sql functions + add tests