I wrote a Python procedure that returns a table (DataFrame). That procedure is called from within a SQL procedure which just stores the result of the nested procedure as result set and returns it.