Hi,
I saw here 11937 that it is possible to set the cache_ttl value for each individual card. The post shows a query to be run against Metabase database but as we are a SaaS client I am not sure how to access this database + I would prefer not to mess with it and use the API instead.
So I have tried doing it using the API but it does not seem to work. All my card-level cache_ttl values remain null. Am I doing anything wrong ?
Here is my code:
card = requests.get(f'{metabase_url}/api/card/570', headers=headers).json()
print(card['cache_ttl'] is None) # True
requests.put(f'{metabase_url}/api/card/570', headers=headers, json={'cache_ttl': True})
# status_code 202 (success)
card = requests.get(f'{metabase_url}/api/card/570', headers=headers).json()
print(card['cache_ttl'] is None) # Still True
Our environment details :
{
"browser-info": {
"language": "fr-FR",
"platform": "MacIntel",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36",
"vendor": "Google Inc."
},
"system-info": {
"file.encoding": "UTF-8",
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.12+7",
"java.vendor": "Eclipse Foundation",
"java.vendor.url": "https://adoptium.net/",
"java.version": "11.0.12",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.12+7",
"os.name": "Linux",
"os.version": "4.14.219-164.354.amzn2.x86_64",
"user.language": "en",
"user.timezone": "GMT"
},
"metabase-info": {
"databases": [
"postgres",
"h2"
],
"hosting-env": "unknown",
"application-database": "postgres",
"application-database-details": {
"database": {
"name": "PostgreSQL",
"version": "11.9"
},
"jdbc-driver": {
"name": "PostgreSQL JDBC Driver",
"version": "42.2.18"
}
},
"run-mode": "prod",
"version": {
"date": "2021-09-21",
"tag": "v1.40.5",
"branch": "release-x.40.x",
"hash": "042a36e"
},
"settings": {
"report-timezone": "Europe/Berlin"
}
}
}