I have a stored function in postgres:
CREATE FUNCTION return_curs() RETURNS refcursor AS $$
BEGIN
OPEN cursor_x FOR SELECT col FROM table_y;
RETURN cursor_x;
END; $$
Then in Python I want to invoke the procedure to fetch returnung cursor row by row for exapmle using psycopg2. Are there any way to perform this? Thanks.