villebro commented on issue #9572:
URL:
https://github.com/apache/incubator-superset/pull/9572#issuecomment-616338771
I agree, users will probably expect url_params to be added to cache keys.
Perhaps we default `url_params` to add the value to `extra_cache_keys`, but
leave an option to opt out:
```python
def url_param(param: str, default: Optional[str] = None, add_to_cache_keys:
bool=True) -> Optional[Any]:
...
```
Then we also need to change the regex `has_calls_to_cche_key_wrapper` in
`connectors/models/sqla.py` to be something along the lines of
```python
regex = re.compile(r"\{\{.*(cache_key_wrapper\(.*\)|url_param\(.*).*\}\}")
```
to make sure we don't unnecessarily trigger re-evaluation of jinja code. As
I added this feature, I can put together a PR for it if you wish.
Oh, the syntax for `cache_key_wrapper` is fairly simple, just wrap it around
whatever JSON serializable value you want to add to keys:
```python
{{ cache_key_wrapper(url_param("key", "my default value")) }}
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]