Peter, thanks for the assist. A couple of notes:

I was hoping to display a page that listed page names and last mod
date, with the last modifed (10) pages listed...

1) Neither query returns the mod_date_time itself, so I'll still have
to resort to either hitting the db for each of the last 10 pages to get
the last mod date or denorm that into the Page. Here's what I'll
probably do:

for page in Page.select(...)[:10]:
  page.last_mod_date = page.get_entries().reversed()[0:1].mod_date_time

But it would be nice if the Page.select() would actually return the
other fields that were requested by the :
'list(Page.select(EXISTS(Select(Entry.q.mod_date_time, where...'

What would be really cool is if SQLObject would set attributes in the
returned object that included the join fields, like I attempt above:

for f in foo.select(bar.col01, bar.col02, where=foo.col01==barc.col03):
  print dir(f)
<foo f.col01, f.col02, bar.col01, bar.col02>

2) The leftjoin...on my system, this worked for me 'LEFTJOINOn'

3) I couldn't get the 'limit' to work properly, so I removed it.

Thanks for your input...I'm still chewing away at this.

In [38]: list(Page.select(EXISTS(Select(Entry.q.mod_date_time,
where=(Page.q.id == Entry.q.pageID)))))
Out[38]:
[<Page 1 pagename='FrontPage'>,
 <Page 2 pagename='AnotherPage'>,
 <Page 3 pagename='favicon.ico'>,
 <Page 4 pagename='SuperPage'>,
 <Page 5 pagename='QuePage'>,
 <Page 6 pagename='AaaBbb'>,
 <Page 7 pagename='StonedRoses'>,
 <Page 8 pagename='OtherPage'>,
 <Page 9 pagename='ZebraPage'>,
 <Page 10 pagename='ZebraPups'>,
 <Page 11 pagename='CodePage'>,

In [39]: list(Page.select(join=LEFTJOINOn(Page, Entry, Page.q.id ==
Entry.q.pageID), orderBy="mod_date_time"))
Out[39]:
[<Page 1 pagename='FrontPage'>,
 <Page 1 pagename='FrontPage'>,
 <Page 1 pagename='FrontPage'>,
 <Page 1 pagename='FrontPage'>,
 <Page 1 pagename='FrontPage'>,
 <Page 1 pagename='FrontPage'>,
 <Page 1 pagename='FrontPage'>,
 <Page 1 pagename='FrontPage'>,
 <Page 1 pagename='FrontPage'>,
 <Page 1 pagename='FrontPage'>,
 <Page 1 pagename='FrontPage'>,
 <Page 2 pagename='AnotherPage'>,
 <Page 2 pagename='AnotherPage'>,
 <Page 2 pagename='AnotherPage'>,
 <Page 2 pagename='AnotherPage'>,
 <Page 2 pagename='AnotherPage'>,
 <Page 2 pagename='AnotherPage'>,
 <Page 1 pagename='FrontPage'>,
 <Page 3 pagename='favicon.ico'>,
 <Page 3 pagename='favicon.ico'>,
 <Page 3 pagename='favicon.ico'>,

Reply via email to