Hi Malcolm,

I like this since a lot. Your approach to put the SQL construction into
a different query reminds me much of SQLAlchemy. A quote from their
tutorial [1]:

"""A central concept of SQLAlchemy is that it actually contains two
distinct areas of functionality, one of which builds upon the other. One
is a SQL Construction Language and the other is an Object Relational
Mapper ("ORM" for short). """

SQLAlchemy supports these databases: SQLite, Postgres, MySQL, and
Oracle, as well as developmental support for MS-SQL and Firebird. So our
set is covered.

Why not ditch the current SQL construction code in QuerySet and replace
it with SQLAlchemy? While it adds an external dependency, I feel that
SQLAlchemy has solved these problems much better than Django has. Let's
continue to use our own Django-API for it, but use the machinery of
SQLAlchemy! Really, if you'd think about creating a web application
framework from start today, you wouldn't bother to handle SQL
construction on your own.

There is already the SQLAlchemy branch with exactly this goal in Django,
but it seems to be only merges of trunk without any own code.

The problem of SQL construction isn't trivial. We currently have a few
bugs around multiple joins to the same tables where we create wrong SQL
[2]. These also demonstrate that an API that is able to express all
kinds of SQL statements needs a lot of care. Using SqlAlchemy for the
query construction probably opens a path to also use their mapper when
you really need it.

References:

[1] http://www.sqlalchemy.org/docs/tutorial.myt#tutorial_twoinone
[2] Tickets #1801, #2253, #2496,


Cheers,

Michael


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to