Re: [sqlalchemy] When to set "cache_ok" to True?

2021-05-26 Thread Mike Bayer
most (although some are missing) of the examples illustrate it such as https://docs.sqlalchemy.org/en/14/core/custom_types.html#store-timezone-aware-timestamps-as-timezone-naive-utc class TZDateTime(TypeDecorator): impl = DateTime cache_ok = True def process_bind_param(self, value,

Re: [sqlalchemy] When to set "cache_ok" to True?

2021-05-26 Thread Jinghui Niu
Thank you. Could you please also give some hint on a case where we must set this attribute to `False`? On Wed, May 26, 2021 at 5:54 AM Mike Bayer wrote: > > > On Wed, May 26, 2021, at 3:07 AM, niuji...@gmail.com wrote: > > I have consistently receiving the warning: > will not produce a cache

Re: [sqlalchemy] When to set "cache_ok" to True?

2021-05-26 Thread Mike Bayer
On Wed, May 26, 2021, at 3:07 AM, niuji...@gmail.com wrote: > I have consistently receiving the warning: > will not produce a cache key because the ``cache_ok`` flag is not set to > True. Set this flag to True if this type object's state is safe to use in a >

[sqlalchemy] When to set "cache_ok" to True?

2021-05-26 Thread niuji...@gmail.com
I have consistently receiving the warning: will not produce a cache key because the ``cache_ok`` flag is not set to True. Set this flag to True if this type object's state is safe to use in a cache key, or False to disable this warning. After reading the documentation, I learned that the