Re: [sqlalchemy] still unclear how to invoke stored procedures with sqlalchemy

2018-02-05 Thread Mike Bayer
SQL server may require the use of cursor.callproc() to execute a stores procedure, see the documentation section on "raw cursor access" for that. In that case you are better off just executing the textual SQL directly. Though if the function works inside of a SELECT then sure the same use as with

Re: [sqlalchemy] still unclear how to invoke stored procedures with sqlalchemy

2018-02-05 Thread naufal . sarghini
What if you wanted to execute a Stored Procedure but from SQL Server instead of PostgreSQL? Will the same logic work? -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable

Re: [sqlalchemy] still unclear how to invoke stored procedures with sqlalchemy

2011-10-15 Thread Michael Bayer
On Oct 15, 2011, at 3:24 PM, Krishnakant Mane wrote: > On 15/10/11 22:17, Michael Bayer wrote: > >> 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 "

Re: [sqlalchemy] still unclear how to invoke stored procedures with sqlalchemy

2011-10-15 Thread Krishnakant Mane
On 15/10/11 22:17, Michael Bayer wrote: 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

Re: [sqlalchemy] still unclear how to invoke stored procedures with sqlalchemy

2011-10-15 Thread Michael Bayer
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; > re

Re: [sqlalchemy] still unclear how to invoke stored procedures with sqlalchemy

2011-10-15 Thread Krishnakant Mane
Thanks michael, But my problem here is different. Let me give you the exact stored procedure that we have here for execution. 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

Re: [sqlalchemy] still unclear how to invoke stored procedures with sqlalchemy

2011-10-15 Thread Michael Bayer
On Oct 15, 2011, at 7:52 AM, Krishnakant Mane wrote: > > On 12/09/11 03:09, Michael Bayer wrote: >> On Sep 11, 2011, at 3:43 PM, Krishnakant Mane wrote: >> >>> On 12/09/11 00:56, Michael Bayer wrote: You use the "func" construct to invoke a function. This can be passed to an execute

Re: [sqlalchemy] still unclear how to invoke stored procedures with sqlalchemy

2011-10-15 Thread Krishnakant Mane
On 12/09/11 03:09, Michael Bayer wrote: On Sep 11, 2011, at 3:43 PM, Krishnakant Mane wrote: On 12/09/11 00:56, Michael Bayer wrote: You use the "func" construct to invoke a function. This can be passed to an execute() method directly where it should embed itself into a SELECT: fro

Re: [sqlalchemy] still unclear how to invoke stored procedures with sqlalchemy

2011-09-11 Thread Michael Bayer
On Sep 11, 2011, at 3:43 PM, Krishnakant Mane wrote: > On 12/09/11 00:56, Michael Bayer wrote: >> You use the "func" construct to invoke a function. This can be passed to an >> execute() method directly where it should embed itself into a SELECT: >> >> from sqlalchemy import func >> >>

Re: [sqlalchemy] still unclear how to invoke stored procedures with sqlalchemy

2011-09-11 Thread Krishnakant Mane
On 12/09/11 00:56, Michael Bayer wrote: You use the "func" construct to invoke a function. This can be passed to an execute() method directly where it should embed itself into a SELECT: from sqlalchemy import func result = engine.execute(func.name_of_my_pg_function(1, 2, 3)) S

Re: [sqlalchemy] still unclear how to invoke stored procedures with sqlalchemy

2011-09-11 Thread Michael Bayer
You use the "func" construct to invoke a function. This can be passed to an execute() method directly where it should embed itself into a SELECT: from sqlalchemy import func result = engine.execute(func.name_of_my_pg_function(1, 2, 3)) Manipulation of cursors is not supported

[sqlalchemy] still unclear how to invoke stored procedures with sqlalchemy

2011-09-11 Thread Krishnakant Mane
I think the subject line makes it pritty clear. I want to know how i can use the expression api to make calls to postgresql stored procedures written in plpgsql. For example how to pass input parameters and how to manipulate cursor objects etc. happy hacking. Krishnakant. -- You received this