replaced raw sql in jqtree with sqlalchemy query