So it caching selects to disk or redis supposed to only work if you have uniquely named fields? It doesn't seem to make a difference if I set cachable=True or not.
On Tuesday, April 3, 2018 at 5:15:25 PM UTC-5, Brian M wrote: > > Further investigation shows that cache.redis plays nicely with pyodbc *as > long as you have all uniquely named fields in your select*. The selects > that I was working with involved multiple tables that each had a "Name" > field that was being selected. If I add .with_alias() to provide unique > names then caching worked but that's also not really convenient. Is this > the way it is supposed to work? > > On Tuesday, April 3, 2018 at 2:16:30 PM UTC-5, Anthony wrote: >> >> You can also see what happens if you do not set cacheable=True. >> >> On Tuesday, April 3, 2018 at 3:15:55 PM UTC-4, Anthony wrote: >>> >>> It should work. Could be a bug specific to using pyodbc. Have you tried >>> it with other databases/drivers? Feel free to file a PyDAL issue. >>> >>> Anthony >>> >>> On Tuesday, April 3, 2018 at 12:40:50 PM UTC-4, Brian M wrote: >>>> >>>> I've been playing with caching and looking through the mailing list and >>>> have a bit of confusion about whether or not you can actually cache DAL >>>> Selects with anything other than cache.ram due to issues with what >>>> can/cannot be pickled. When I use >>>> >>>> db(...).select(...,cache=(cache.disk, 300), cacheable=True) >>>> >>>> Caching works just fine. But if I try it with cache.disk or cache.redis >>>> instead then I get errors which seem to be related to not being able to >>>> unpickle the cached select results. >>>> >>>> type 'exceptions.TypeError'> ("cannot create 'pyodbc.Row' instances", >>>> <type 'pyodbc.Row'>, ....) >>>> >>>> >>>> This, admittedly old, post seems to suggest that cache.redis should be >>>> pretty much drop-in for cache.ram but that's not my experience. >>>> https://groups.google.com/forum/?fromgroups#!searchin/web2py/caching$20model$20data/web2py/Tn4TiLPScII/jtMR1KtT4V8J >>>> >>>> >>>> So does the ability to cache DAL Selects really only exist for >>>> cache.ram or am I missing something? >>>> >>>> >>>> Brian >>>> >>> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.