Hi Carl,

On Wed, 18 Jun 2014, Carl Meyer wrote:
On 06/18/2014 02:59 PM, Aymeric Augustin wrote:
2014-06-18 19:18 GMT+02:00 Carl Meyer <c...@oddbird.net
<mailto:c...@oddbird.net>>:

If you need a Function in your project (whether provided by Django or by a third-party library), and the Function doesn't natively support the database backend you're using, you can simply subclass it, add the appropriate as_vendor method, and use your subclass.

I was thinking about third-party database backends. How are they expected to ship customised implementations of Functions included in Django?

Yes, I wasn't thinking about this case in my first mail, and I agree
that this is a serious problem for the pure as_vendor() approach; it's
not acceptable IMO to expect third-party database backends to
monkeypatch their as_vendor() methods onto the built-in Function classes.

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?

Cheers, Chris.
--
Aptivate | http://www.aptivate.org | Phone: +44 1223 967 838
Citylife House, Sturton Street, Cambridge, CB1 2QF, UK

Aptivate is a not-for-profit company registered in England and Wales
with company number 04980791.

--
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/alpine.DEB.2.02.1406182253240.4005%40lap-x201.
For more options, visit https://groups.google.com/d/optout.

Reply via email to