On Thursday 23 October 2014 06:14:19 Carl Meyer wrote: > > On Oct 22, 2014, at 5:56 PM, Shai Berger <[email protected]> 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 SQL > >>> (assuming it is going to interact with the database either way), and so > >>> it is good API design to abstact this detail away. > >> > >> 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't think it is good API design to abstract away > >> differences that the caller should be aware of. (For one example of a > >> difference, database stored procedures "return a modified copy of the > >> input arguments", which would be extremely unusual behavior for a normal > >> Python function.) > > > > That, of course, doesn't have to be the case for the wrapper API. > > Well, that's the problem, isn't it? A purpose-built nice Python wrapper for > a particular stored procedure can certainly do something better, but I'm > not sure what else a generic wrapper system could do. You don't know which > parameters to an arbitrary proc might be output parameters (unless you try > some kind of runtime introspection, or require a registration step where > the user tells you about the signature; at that point you may as well just > let the user write their own wrapper). There's a reason 'callproc' has the > odd signature it does. > Just to give this proper closure: I think there's a lot that can be improved under certain assumptions -- from the trivial "the user doesn't care about the output params" to the specific "the procedure yields a result-set that is suitable for a queryset of model X" (this is the assumption/requirement that queryset.raw() makes). But given the opposition, I will let this go now.
Shai. -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/201410252006.00620.shai%40platonix.com. For more options, visit https://groups.google.com/d/optout.
