From 4496748cd942b037a9e497edc336bd3e3d48717a Mon Sep 17 00:00:00 2001 From: Beto Dealmeida Date: Tue, 8 Nov 2022 15:03:58 -0800 Subject: [PATCH] chore: update Druid (#22067) --- requirements/development.txt | 2 +- setup.py | 2 +- superset/db_engine_specs/druid.py | 8 +------- superset/db_engine_specs/trino.py | 2 +- superset/models/core.py | 4 ++-- superset/views/core.py | 2 +- 6 files changed, 7 insertions(+), 13 deletions(-) diff --git a/requirements/development.txt b/requirements/development.txt index 9990012ab..1bce530ea 100644 --- a/requirements/development.txt +++ b/requirements/development.txt @@ -78,7 +78,7 @@ pure-eval==0.2.2 # via stack-data pure-sasl==0.6.2 # via thrift-sasl -pydruid==0.6.2 +pydruid==0.6.5 # via apache-superset pygments==2.12.0 # via ipython diff --git a/setup.py b/setup.py index cad76a957..a3c7407f9 100644 --- a/setup.py +++ b/setup.py @@ -141,7 +141,7 @@ setup( "db2": ["ibm-db-sa>=0.3.5, <0.4"], "dremio": ["sqlalchemy-dremio>=1.1.5, <1.3"], "drill": ["sqlalchemy-drill==0.1.dev"], - "druid": ["pydruid>=0.6.1,<0.7"], + "druid": ["pydruid>=0.6.5,<0.7"], "solr": ["sqlalchemy-solr >= 0.2.0"], "elasticsearch": ["elasticsearch-dbapi>=0.2.9, <0.3.0"], "exasol": ["sqlalchemy-exasol >= 2.4.0, <3.0"], diff --git a/superset/db_engine_specs/druid.py b/superset/db_engine_specs/druid.py index 1484429ba..6cdc9f85e 100644 --- a/superset/db_engine_specs/druid.py +++ b/superset/db_engine_specs/druid.py @@ -19,7 +19,6 @@ import logging from datetime import datetime from typing import Any, Dict, List, Optional, Type, TYPE_CHECKING -from sqlalchemy import types from sqlalchemy.engine.reflection import Inspector from superset import is_feature_enabled @@ -131,16 +130,11 @@ class DruidEngineSpec(BaseEngineSpec): """ Update the Druid type map. """ - # pylint: disable=import-outside-toplevel - from pydruid.db.sqlalchemy import type_map - - type_map["complex"] = types.BLOB - return super().get_columns(inspector, table_name, schema) @classmethod def get_dbapi_exception_mapping(cls) -> Dict[Type[Exception], Type[Exception]]: - # pylint: disable=import-error,import-outside-toplevel + # pylint: disable=import-outside-toplevel from requests import exceptions as requests_exceptions return { diff --git a/superset/db_engine_specs/trino.py b/superset/db_engine_specs/trino.py index 490a36ab2..c62a9d58b 100644 --- a/superset/db_engine_specs/trino.py +++ b/superset/db_engine_specs/trino.py @@ -224,7 +224,7 @@ class TrinoEngineSpec(PrestoBaseEngineSpec): @classmethod def get_dbapi_exception_mapping(cls) -> Dict[Type[Exception], Type[Exception]]: - # pylint: disable=import-error,import-outside-toplevel + # pylint: disable=import-outside-toplevel from requests import exceptions as requests_exceptions return { diff --git a/superset/models/core.py b/superset/models/core.py index 4985ecf9f..86b9eb1bd 100755 --- a/superset/models/core.py +++ b/superset/models/core.py @@ -563,7 +563,7 @@ class Database( database=self, inspector=self.inspector, schema=schema ) return [(table, schema) for table in tables] - except Exception as ex: # pylint: disable=broad-except + except Exception as ex: raise self.db_engine_spec.get_dbapi_mapped_exception(ex) @cache_util.memoized_func( @@ -593,7 +593,7 @@ class Database( database=self, inspector=self.inspector, schema=schema ) return [(view, schema) for view in views] - except Exception as ex: # pylint: disable=broad-except + except Exception as ex: raise self.db_engine_spec.get_dbapi_mapped_exception(ex) @cache_util.memoized_func( diff --git a/superset/views/core.py b/superset/views/core.py index 353671ef0..cc1865452 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -327,7 +327,7 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods @has_access @event_logger.log_this @expose("/approve", methods=["POST"]) - def approve(self) -> FlaskResponse: # pylint: disable=too-many-locals,no-self-use + def approve(self) -> FlaskResponse: # pylint: disable=too-many-locals def clean_fulfilled_requests(session: Session) -> None: for dar in session.query(DAR).all(): datasource = DatasourceDAO.get_datasource(