On 06/18/2014 04:41 PM, Chris Wilson wrote:
>>>> I think database backends should have a hook to override the SQL
>>>> implementation of any given Function. I don't think this needs to
>>>> imply pushing the default implementation of all Functions down into
>>>> the database backend (that just makes life unnecessarily difficult
>>>> for third-party Functions).
>>>
>>> Why does it even need a hook or monkey-patching? Why not pass the
>>> expression tree to the SQL backend (as the most natural format for
>>> programmatically parsing), for it to render out in backend-specific
>>> SQL as it sees fit? Perhaps relying in inherited base methods in most
>>> cases, and overriding a few methods where that backend needs to
>>> render a particular feature differently?
>>
>> Yes - that's going all the way to the other end of the spectrum,
>> making life easier for third-party database backends at the expense of
>> third-party Functions. How, in your plan, is a third-party Function
>> (which won't be recognized by any database backend's SQL emitter)
>> supposed to provide "just works" support for all built-in database
>> backends, presuming it needs different SQL for different backends?
> 
> Good point, thanks :)
> 
> If neither the backend knows about the function, nor the function about
> the backend, then a third-party module would have to register support
> for both (e.g. "I know how to convert a Case() Function into HSQLDB
> SQL"). Perhaps we could have a registry where third-party modules could
> register such support.

Yes; this is what I meant by "perhaps supported by a
public API to register additional function-implementation overrides at
ready()" in my mail that you originally replied to.

Carl

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
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/53A219F1.4020508%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to