sqlite & python 2.5

Joseph cephire at gmail.com
Sat Oct 14 05:06:58 CEST 2006

I am using python 2.5 under windows. I am trying to do the below:

    cursor.execute("SELECT postid, title, body, teaser, postdate,
posttime, author, status, format, allow_comments, notify_on_comments,
catname \
    FROM ton_posts p, ton_category c \
    where c.catid = p.category and status = 1 and strftime('%Y',
p.postdate) in(?) and strftime('%m', p.postdate) in(?) and c.catid
    order by postdate desc, posttime desc",sqlvars)

print cursor.fetchall()

But it always returns empty (though there is value in db).

For ref:
sqlvars = ("select distinct strftime('%Y',postdate) from ton_posts",
"select distinct strftime('%m',postdate) from ton_posts", 'select catid
from ton_category')

Is there anyway I can find out the sql that gets executed (after the
varible substitution)?

Also can anyone help me out in finding out what is wrong here?

Thanks a lot

More information about the Python-list mailing list