sqlite & python 2.5

Joseph cephire at gmail.com
Fri Oct 13 23:06:58 EDT 2006


Hi,
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
in(?)\
    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
Joseph




More information about the Python-list mailing list