How Do I Express A Function That Returns A Setof Record In Sqlalchemy?
I need to execute a pg function that returns a setof record type. Here is the function in postgres: CREATE OR REPLACE FUNCTION testfunction(text, text) RETURNS SETOF RECORD AS '
Solution 1:
It appears you can't:
From http://docs.sqlalchemy.org/en/rel_0_9/core/functions.html#sqlalchemy.sql.functions.func
The func construct has only limited support for calling standalone “stored procedures”, especially those with special parameterization concerns.
See the section Calling Stored Procedures for details on how to use the DBAPI-level callproc() method for fully traditional stored procedures.
Obviously, you can fall back to plain SQL interpolation:
>> print sa.select().select_from('a AS f(a int, b int)')
SELECT
FROM a AS f(a int, b int)
Post a Comment for "How Do I Express A Function That Returns A Setof Record In Sqlalchemy?"