potiuk commented on PR #40836:
URL: https://github.com/apache/airflow/pull/40836#issuecomment-2236391589

   > It's a pitty that I can't use the functools.lru_cache decorator? I could 
use the [cachetools cache 
decorator](https://cachetools.readthedocs.io/en/latest/), but then that would 
add an extra dependency. Dunno why unctools.lru_cache is banned, as per default 
it has a maxsize of 128 entries per cached method? This method needs to be 
cache as it will be called multiple times per chunked insert rows, otherwise we 
could end up having the same issue as in 
[#40609](https://github.com/apache/airflow/issues/40609). A decorator also 
looks nicer instead of manually implementing it with a class member as it is a 
cross cutting concern.
   
   Functools.lru_cache should not be use on object methods only on functions. 
https://stackoverflow.com/questions/33672412/python-functools-lru-cache-with-instance-methods-release-object
   
   And we are using methodtools.lru_cache instead (already our dependency).
   
   See https://github.com/apache/airflow/pull/37757. Maybe a good idea (feel 
free to add PR) is to update the description of error and suggest to use 
methodtools insteadl
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to