chore(key-value): convert command to dao (#29344)

This commit is contained in:
Ville Brofeldt
2024-07-01 20:22:11 +03:00
committed by GitHub
parent 0cf676b574
commit 7d6e933348
36 changed files with 867 additions and 1162 deletions

View File

@@ -21,7 +21,7 @@ from sqlalchemy.exc import SQLAlchemyError
from superset.commands.dataset.exceptions import DatasetNotFoundError
from superset.commands.explore.permalink.base import BaseExplorePermalinkCommand
from superset.commands.key_value.get import GetKeyValueCommand
from superset.daos.key_value import KeyValueDAO
from superset.explore.permalink.exceptions import ExplorePermalinkGetFailedError
from superset.explore.permalink.types import ExplorePermalinkValue
from superset.explore.utils import check_access as check_chart_access
@@ -44,11 +44,7 @@ class GetExplorePermalinkCommand(BaseExplorePermalinkCommand):
self.validate()
try:
key = decode_permalink_id(self.key, salt=self.salt)
value: Optional[ExplorePermalinkValue] = GetKeyValueCommand(
resource=self.resource,
key=key,
codec=self.codec,
).run()
value = KeyValueDAO.get_value(self.resource, key, self.codec)
if value:
chart_id: Optional[int] = value.get("chartId")
# keep this backward compatible for old permalinks