Cache and logging

[edit|delete]

sql.log logs only CREATE, DROP, and ALTER table.

INSERTs, UPDATEs and SELECTs are logged one at the time in the db._lastsql string.

To check whether caching is used you can do

db._lastsql=None
rows=db(...).select(...,cache=(cache.ram,60))
if db._lastsql:
    print 'SQL WAS EXECUTED AND RESULT CACHED:',db._lastsql
else:
    print 'SQL WAS NOT EXECUTED, DATA RETRIEVED FROM CACHE'


Post a comment