Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable deprecated druid connector by default #8512

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions UPDATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ assists people when migrating to a new version.

## Next Version

* [8512](https://github.com/apache/incubator-superset/pull/8512): `DRUID_IS_ACTIVE` now
defaults to False. To enable Druid-API-based functionality, override the
`DRUID_IS_ACTIVE` configuration variable by setting it to `True` for your deployment.

* [8450](https://github.com/apache/incubator-superset/pull/8450): The time ranger picker
now uses UTC for the tooltips and default placeholder timestamps (sans timezone).

Expand Down
7 changes: 6 additions & 1 deletion superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,15 @@ def _try_json_readsha(filepath):
# [TimeZone List]
# See: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
# other tz can be overridden by providing a local_config
DRUID_IS_ACTIVE = True
DRUID_TZ = tz.tzutc()
DRUID_ANALYSIS_TYPES = ["cardinality"]

# Legacy Druid connector
# Druid supports a SQL interface in its newer versions.
# Setting this flag to True enables the deprecated, API-based Druid
# connector. This feature may be removed at a future date.
DRUID_IS_ACTIVE = False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@willbarret apologies for not mentioning this sooner but can we rename this to something more specific, i.e., DRUID_NATIVE_IS_ACTIVE or DRUID_NOSQL_IS_ACTIVE?


# ----------------------------------------------------
# AUTHENTICATION CONFIG
# ----------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions tests/druid_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from unittest.mock import Mock, patch

from superset import db, security_manager
from tests.test_app import app

from .base_tests import SupersetTestCase

Expand Down Expand Up @@ -297,6 +298,7 @@ def check():
@unittest.skipUnless(
SupersetTestCase.is_module_installed("pydruid"), "pydruid not installed"
)
@unittest.skipUnless(app.config["DRUID_IS_ACTIVE"], "DRUID_IS_ACTIVE is false")
def test_filter_druid_datasource(self):
CLUSTER_NAME = "new_druid"
cluster = self.get_or_create(
Expand Down
19 changes: 0 additions & 19 deletions tests/security_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ def assert_can_all(self, view_menu, permissions_set):
self.assert_can_read(view_menu, permissions_set)
self.assert_can_write(view_menu, permissions_set)

def assert_cannot_gamma(self, perm_set):
self.assert_cannot_write("DruidColumnInlineView", perm_set)

def assert_can_gamma(self, perm_set):
self.assert_can_read("DatabaseAsync", perm_set)
self.assert_can_read("TableModelView", perm_set)
Expand Down Expand Up @@ -86,12 +83,8 @@ def assert_can_alpha(self, perm_set):
self.assert_can_all("SqlMetricInlineView", perm_set)
self.assert_can_all("TableColumnInlineView", perm_set)
self.assert_can_all("TableModelView", perm_set)
self.assert_can_all("DruidColumnInlineView", perm_set)
self.assert_can_all("DruidDatasourceModelView", perm_set)
self.assert_can_all("DruidMetricInlineView", perm_set)

self.assertIn(("all_datasource_access", "all_datasource_access"), perm_set)
self.assertIn(("muldelete", "DruidDatasourceModelView"), perm_set)

def assert_cannot_alpha(self, perm_set):
if app.config["ENABLE_ACCESS_REQUEST"]:
Expand All @@ -104,7 +97,6 @@ def assert_cannot_alpha(self, perm_set):
def assert_can_admin(self, perm_set):
self.assert_can_read("DatabaseAsync", perm_set)
self.assert_can_all("DatabaseView", perm_set)
self.assert_can_all("DruidClusterModelView", perm_set)
self.assert_can_all("RoleModelView", perm_set)
self.assert_can_all("UserDBModelView", perm_set)

Expand Down Expand Up @@ -185,13 +177,6 @@ def test_is_alpha_only(self):
)
)
)
self.assertTrue(
security_manager._is_alpha_only(
security_manager.find_permission_view_menu(
"can_delete", "DruidMetricInlineView"
)
)
)
self.assertTrue(
security_manager._is_alpha_only(
security_manager.find_permission_view_menu(
Expand All @@ -209,7 +194,6 @@ def test_is_gamma_pvm(self):

def test_gamma_permissions_basic(self):
self.assert_can_gamma(get_perm_tuples("Gamma"))
self.assert_cannot_gamma(get_perm_tuples("Gamma"))
self.assert_cannot_alpha(get_perm_tuples("Alpha"))

@unittest.skipUnless(
Expand All @@ -234,15 +218,13 @@ def test_sql_lab_permissions(self):
self.assertIn(("can_csv", "Superset"), sql_lab_set)
self.assertIn(("can_search_queries", "Superset"), sql_lab_set)

self.assert_cannot_gamma(sql_lab_set)
self.assert_cannot_alpha(sql_lab_set)

def test_granter_permissions(self):
granter_set = get_perm_tuples("granter")
self.assertIn(("can_override_role_permissions", "Superset"), granter_set)
self.assertIn(("can_approve", "Superset"), granter_set)

self.assert_cannot_gamma(granter_set)
self.assert_cannot_alpha(granter_set)

def test_gamma_permissions(self):
Expand Down Expand Up @@ -273,7 +255,6 @@ def assert_can_all(view_menu):

# check read only perms
assert_can_read("TableModelView")
assert_cannot_write("DruidColumnInlineView")

# make sure that user can create slices and dashboards
assert_can_all("SliceModelView")
Expand Down