[postmodern-devel] Retrieving completely populated DAOs based on SQL string query

Mitch Berkson mitch at bermita.com
Tue Oct 5 11:21:48 UTC 2010


  Marijn,

Sorry to hide too much in the etc. It is relevant. Substituting for the etc:

(select-dao 'foo-db-name (:in 'foo.id (:set (flatten (query "SELECT 
DISTINCT foo.id FROM foo_member INNER JOIN foo_show ON (foo_member.id = 
foo_show.member_id) INNER JOIN foo_series ON (foo_show.series_id = 
foo_series.id) WHERE foo_series.year = 2011))))

This query is something django generates from a much more 
civilized-looking expression.

Mitch



On 10/5/2010 5:02 AM, Marijn Haverbeke wrote:
> Hi Mitch,
>
>> (select-dao 'foo-db-name (:in 'foo.id (:set (flatten (query "SELECT
>> DISTINCT foo.id FROM foo, etc.")))))
> I'm not quite sure what you are trying to achieve. Unless the 'etc'
> was relevant, you seem to be selecting all ids from your foo table,
> and then select only those rows in the foo table that have an id that
> exists in the foo table -- i.e., every single row. Why? If your 'etc'
> is a WHERE clause, you should be able to directly pass it as the test
> argument to select-dao.
>
> Best,
> Marijn
>
> _______________________________________________
> postmodern-devel mailing list
> postmodern-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel
>




More information about the postmodern-devel mailing list