Re: cursor.callproc()

2014-10-25 Thread Shai Berger
On Thursday 23 October 2014 06:14:19 Carl Meyer wrote: > > On Oct 22, 2014, at 5:56 PM, Shai Berger wrote: > >> On Wednesday 22 October 2014 19:35:49 Carl Meyer wrote: > >>> On 10/21/2014 04:04 PM, Shai Berger wrote: > >>> I'd argue that in the common case, the user shouldn't care if the > >>> fun

Re: cursor.callproc()

2014-10-23 Thread Marc Tamlyn
I will happily cede ground to people who actually use stored procedures. On 23 October 2014 04:14, Carl Meyer wrote: > > > On Oct 22, 2014, at 5:56 PM, Shai Berger wrote: > >> On Wednesday 22 October 2014 19:35:49 Carl Meyer wrote: > >>> On 10/21/2014 04:04 PM, Shai Berger wrote: > >>> I'd argu

Re: cursor.callproc()

2014-10-22 Thread Carl Meyer
> On Oct 22, 2014, at 5:56 PM, Shai Berger wrote: >> On Wednesday 22 October 2014 19:35:49 Carl Meyer wrote: >>> On 10/21/2014 04:04 PM, Shai Berger wrote: >>> I'd argue that in the common case, the user shouldn't care if the >>> function they are calling is implemented in Python or Procedural SQ

Re: cursor.callproc()

2014-10-22 Thread Michael Manfre
On Wed, Oct 22, 2014 at 12:35 PM, Carl Meyer wrote: > Here is where we differ. I think calling a database stored procedure is > fundamentally a different thing from calling a Python function (even one > that accesses the database), and the difference should be obvious in the > calling code. I don

Re: cursor.callproc()

2014-10-22 Thread Shai Berger
Hi Carl, On Wednesday 22 October 2014 19:35:49 Carl Meyer wrote: > On 10/21/2014 04:04 PM, Shai Berger wrote: > > I'd argue that in the common case, the user shouldn't care if the > > function they are calling is implemented in Python or Procedural SQL > > (assuming it is going to interact with th

Re: cursor.callproc()

2014-10-22 Thread Carl Meyer
Hi Shai, On 10/21/2014 04:04 PM, Shai Berger wrote: > On Monday 20 October 2014 21:26:50 Carl Meyer wrote: >> Hi Marc, >> >> On 10/19/2014 12:54 AM, Marc Tamlyn wrote: >>> I guess now with migrations we have a nice way of running the SQL >>> against the database to create the stored procedures. >>

Re: cursor.callproc()

2014-10-22 Thread Carl Meyer
Hi Chris, On 10/22/2014 09:05 AM, Chris Foresman wrote: > Good points. I went looking for `callproc()` documentation and couldn't > find anything useful, which if I understand correctly is part of the > reason this thread started. So +1 on documenting it! > > The most complicated part of dealing

Re: cursor.callproc()

2014-10-22 Thread Chris Foresman
Good points. I went looking for `callproc()` documentation and couldn't find anything useful, which if I understand correctly is part of the reason this thread started. So +1 on documenting it! The most complicated part of dealing with store procedures from a high level is getting them in the d

Re: cursor.callproc()

2014-10-21 Thread Shai Berger
On Monday 20 October 2014 21:26:50 Carl Meyer wrote: > Hi Marc, > > On 10/19/2014 12:54 AM, Marc Tamlyn wrote: > > I guess now with migrations we have a nice way of running the SQL > > against the database to create the stored procedures. > > > > However if we plan to make this a public API, it s

Re: cursor.callproc()

2014-10-21 Thread Shai Berger
On Tuesday 21 October 2014 18:23:44 Chris Foresman wrote: > Is there some benefit to using `.callproc()` over this? > > ``` python > query = 'CALL sp_recommendation_engine(%s, %s)' > profile = user.get_profile() > cursor = connection.cursor() > cursor.execute(query, [user.id, profi

Re: cursor.callproc()

2014-10-21 Thread Chris Foresman
Is there some benefit to using `.callproc()` over this? ``` python query = 'CALL sp_recommendation_engine(%s, %s)' profile = user.get_profile() cursor = connection.cursor() cursor.execute(query, [user.id, profile.id]) ``` On Monday, October 20, 2014 1:29:49 PM UTC-5, Carl Meyer wr

Re: cursor.callproc()

2014-10-20 Thread Carl Meyer
On 10/20/2014 12:26 PM, Carl Meyer wrote: > On 10/19/2014 12:54 AM, Marc Tamlyn wrote: >> I guess now with migrations we have a nice way of running the SQL >> against the database to create the stored procedures. >> >> However if we plan to make this a public API, it should be a nice one. >> Someth

Re: cursor.callproc()

2014-10-20 Thread Carl Meyer
Hi Marc, On 10/19/2014 12:54 AM, Marc Tamlyn wrote: > I guess now with migrations we have a nice way of running the SQL > against the database to create the stored procedures. > > However if we plan to make this a public API, it should be a nice one. > Something along the lines of db.procedures.p

Re: cursor.callproc()

2014-10-19 Thread Shai Berger
o be backend dependent. > > I can't think of a reason to deny cursor.callproc() the same status as > cursor.execute(). > Thanks, Shai. -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself

Re: cursor.callproc()

2014-10-19 Thread Marc Tamlyn
I was thinking in the context of a project - creating a procedure to use in the code. Naturally cursor.execute() is perfectly fine for tests, which would need to be backend dependent. I can't think of a reason to deny cursor.callproc() the same status as cursor.execute(). Marc On 19 Oc

Re: cursor.callproc()

2014-10-19 Thread Shai Berger
Hi Marc and all, On Sunday 19 October 2014 09:54:39 Marc Tamlyn wrote: > I guess now with migrations we have a nice way of running the SQL against > the database to create the stored procedures. > I'm not sure RunSQL is much preferable to cursor.execute() in this context. And either way, it does

Re: cursor.callproc()

2014-10-18 Thread Marc Tamlyn
ts; > some > database drivers (notably cx_Oracle) allow passing also a dictionary of > named > arguments, so we want to support that too. While reviewing the PR, we found > that > > (a) cursor.callproc is not documented > (b) cursor.callproc is not tested (except for one Oracle-sp

cursor.callproc()

2014-10-18 Thread Shai Berger
3] to enhance this method -- the pep249 definition takes the procedure name and a list of positional arguments; some database drivers (notably cx_Oracle) allow passing also a dictionary of named arguments, so we want to support that too. While reviewing the PR, we found that (a) cursor.call