Skip to content

Commit

Permalink
Merge pull request apache#1 from apache/master
Browse files Browse the repository at this point in the history
master update
  • Loading branch information
romaine-murray authored Mar 22, 2023
2 parents 2fa8f98 + 45f045d commit 464a961
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export enum FeatureFlag {
DISABLE_LEGACY_DATASOURCE_EDITOR = 'DISABLE_LEGACY_DATASOURCE_EDITOR',
DISPLAY_MARKDOWN_HTML = 'DISPLAY_MARKDOWN_HTML',
DRILL_TO_DETAIL = 'DRILL_TO_DETAIL',
DRILL_BY = 'DRILL_BY',
DYNAMIC_PLUGINS = 'DYNAMIC_PLUGINS',
EMBEDDABLE_CHARTS = 'EMBEDDABLE_CHARTS',
EMBEDDED_SUPERSET = 'EMBEDDED_SUPERSET',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ const SqlEditor = ({
/>
</Menu.Item>
)}
{scheduledQueriesConf && (
{!isEmpty(scheduledQueriesConf) && (
<Menu.Item>
<ScheduleQueryButton
defaultLabel={qe.name}
Expand Down
7 changes: 6 additions & 1 deletion superset/charts/commands/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
import logging
from typing import Optional
from typing import cast, Optional

from flask_appbuilder.models.sqla import Model
from flask_babel import lazy_gettext as _
Expand Down Expand Up @@ -45,8 +45,13 @@ def __init__(self, model_id: int):

def run(self) -> Model:
self.validate()
self._model = cast(Slice, self._model)
try:
Dashboard.clear_cache_for_slice(slice_id=self._model_id)
# Even though SQLAlchemy should in theory delete rows from the association
# table, sporadically Superset will error because the rows are not deleted.
# Let's do it manually here to prevent the error.
self._model.owners = []
chart = ChartDAO.delete(self._model)
except DAODeleteFailedError as ex:
logger.exception(ex.exception)
Expand Down
1 change: 1 addition & 0 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ def _try_json_readsha(filepath: str, length: int) -> Optional[str]:
# Enable sharing charts with embedding
"EMBEDDABLE_CHARTS": True,
"DRILL_TO_DETAIL": False,
"DRILL_BY": False,
"DATAPANEL_CLOSED_BY_DEFAULT": False,
"HORIZONTAL_FILTER_BAR": False,
# The feature is off by default, and currently only supported in Presto and Postgres,
Expand Down
7 changes: 6 additions & 1 deletion superset/datasets/commands/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
import logging
from typing import Optional
from typing import cast, Optional

from flask_appbuilder.models.sqla import Model
from sqlalchemy.exc import SQLAlchemyError
Expand Down Expand Up @@ -43,7 +43,12 @@ def __init__(self, model_id: int):

def run(self) -> Model:
self.validate()
self._model = cast(SqlaTable, self._model)
try:
# Even though SQLAlchemy should in theory delete rows from the association
# table, sporadically Superset will error because the rows are not deleted.
# Let's do it manually here to prevent the error.
self._model.owners = []
dataset = DatasetDAO.delete(self._model, commit=False)
db.session.commit()
except (SQLAlchemyError, DAODeleteFailedError) as ex:
Expand Down
3 changes: 3 additions & 0 deletions superset/tasks/thumbnails.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ def cache_chart_thumbnail(
logger.warning("No cache set, refusing to compute")
return None
chart = cast(Slice, Slice.get(chart_id))
if not chart:
logger.warning("No chart found, skip computing chart thumbnail")
return None
url = get_url_path("Superset.slice", slice_id=chart.id)
logger.info("Caching chart: %s", url)
_, username = get_executor(
Expand Down

0 comments on commit 464a961

Please sign in to comment.