chore: log cache keys to the logs (#10678)

* Log cache keys to the logs

* Add tests

* Use separate table for the cache keys

* Add migration for the cache lookup table

Co-authored-by: bogdan kyryliuk <bogdankyryliuk@dropbox.com>
This commit is contained in:
Bogdan
2020-09-01 09:41:25 -07:00
committed by GitHub
parent 807bd656c6
commit 4572ebb600
8 changed files with 153 additions and 35 deletions

View File

@@ -35,6 +35,7 @@ from unittest import mock, skipUnless
import pandas as pd
import sqlalchemy as sqla
from superset.models.cache import CacheKey
from tests.test_app import app # isort:skip
import superset.views.utils
from superset import (
@@ -583,6 +584,12 @@ class TestCore(SupersetTestCase):
+ quote(json.dumps([{"col": "name", "op": "in", "val": ["Jennifer"]}]))
) == [{"slice_id": slc.id, "viz_error": None, "viz_status": "success"}]
def test_cache_logging(self):
slc = self.get_slice("Girls", db.session)
self.get_json_resp("/superset/warm_up_cache?slice_id={}".format(slc.id))
ck = db.session.query(CacheKey).order_by(CacheKey.id.desc()).first()
assert ck.datasource_uid == "3__table"
def test_shortner(self):
self.login(username="admin")
data = (