On Oct 15, 2011, at 10:23 AM, Krishnakant Mane wrote:

> create or replace function getGroupByCode(group_code groups.groupcode%type) 
> returns setof groups as $$
> declare
> res groups;
> begin
> for res in select * from groups where groupcode = group_code loop
> return next res;
> end loop;
> return;
> end;
> $$ language plpgsql;
> 
> 
> Now I will give you the code I am trying to run.
> 
> 
> from sqlalchemy.engine import create_engine
> from sqlalchemy import func
> 
> engine = 
> create_engine("postgresql://gnukhata:gnukhata@localhost/K2011101512425529")
> 
> print type(engine)
> 
> 
> res = engine.execute(func.getGroupByCode(1)).scalar()
> 
> 
> print type(res)
> 
> for row in res:
>   print row['groupname']
> 
> Note that the stored procedure refers to a group table that contains 
> groupcode,groupname,groupdesc
> So groupname is a valid column.
> Yet I get the no such column error.
> Can you please explain?

that sounds like an issue in the procedure itself, such as running it on the 
wrong database, or the wrong "groups" table otherwise.   there could be many 
schemas/databases that contain a "groups" table.     Get the procedure to work 
with psql first using the identical login information.





-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to