diff --git a/superset/db_engine_specs/athena.py b/superset/db_engine_specs/athena.py index 91e1069ff68b2..d82591756a003 100644 --- a/superset/db_engine_specs/athena.py +++ b/superset/db_engine_specs/athena.py @@ -47,7 +47,8 @@ def convert_dttm(cls, target_type: str, dttm: datetime) -> Optional[str]: if tt == utils.TemporalType.DATE: return f"from_iso8601_date('{dttm.date().isoformat()}')" if tt == utils.TemporalType.TIMESTAMP: - return f"""from_iso8601_timestamp('{dttm.isoformat(timespec="microseconds")}')""" # pylint: disable=line-too-long + datetime_formatted = dttm.isoformat(timespec="microseconds") + return f"""from_iso8601_timestamp('{datetime_formatted}')""" return None @classmethod diff --git a/superset/db_engine_specs/base.py b/superset/db_engine_specs/base.py index f924ade58e072..de99f6e676b8c 100644 --- a/superset/db_engine_specs/base.py +++ b/superset/db_engine_specs/base.py @@ -59,10 +59,8 @@ if TYPE_CHECKING: # prevent circular imports - from superset.connectors.sqla.models import ( # pylint: disable=unused-import - TableColumn, - ) - from superset.models.core import Database # pylint: disable=unused-import + from superset.connectors.sqla.models import TableColumn + from superset.models.core import Database logger = logging.getLogger() diff --git a/superset/db_engine_specs/bigquery.py b/superset/db_engine_specs/bigquery.py index 71ae8280bc012..1a111cd3bf0e3 100644 --- a/superset/db_engine_specs/bigquery.py +++ b/superset/db_engine_specs/bigquery.py @@ -27,7 +27,6 @@ from superset.utils import core as utils if TYPE_CHECKING: - # pylint: disable=unused-import from superset.models.core import Database # pragma: no cover diff --git a/superset/db_engine_specs/drill.py b/superset/db_engine_specs/drill.py index 7406d654cbe9f..fc3d833cfffbb 100644 --- a/superset/db_engine_specs/drill.py +++ b/superset/db_engine_specs/drill.py @@ -59,7 +59,8 @@ def convert_dttm(cls, target_type: str, dttm: datetime) -> Optional[str]: if tt == utils.TemporalType.DATE: return f"TO_DATE('{dttm.date().isoformat()}', 'yyyy-MM-dd')" if tt == utils.TemporalType.TIMESTAMP: - return f"""TO_TIMESTAMP('{dttm.isoformat(sep=" ", timespec="seconds")}', 'yyyy-MM-dd HH:mm:ss')""" # pylint: disable=line-too-long + datetime_formatted = dttm.isoformat(sep=" ", timespec="seconds") + return f"""TO_TIMESTAMP('{datetime_formatted}', 'yyyy-MM-dd HH:mm:ss')""" return None @classmethod diff --git a/superset/db_engine_specs/druid.py b/superset/db_engine_specs/druid.py index f941fd1bad7b0..1a774983987c9 100644 --- a/superset/db_engine_specs/druid.py +++ b/superset/db_engine_specs/druid.py @@ -23,10 +23,8 @@ from superset.utils import core as utils if TYPE_CHECKING: - from superset.connectors.sqla.models import ( # pylint: disable=unused-import - TableColumn, - ) - from superset.models.core import Database # pylint: disable=unused-import + from superset.connectors.sqla.models import TableColumn + from superset.models.core import Database logger = logging.getLogger() diff --git a/superset/db_engine_specs/hana.py b/superset/db_engine_specs/hana.py index c4b157a624904..11e49d1896ab2 100644 --- a/superset/db_engine_specs/hana.py +++ b/superset/db_engine_specs/hana.py @@ -48,5 +48,6 @@ def convert_dttm(cls, target_type: str, dttm: datetime) -> Optional[str]: if tt == utils.TemporalType.DATE: return f"TO_DATE('{dttm.date().isoformat()}', 'YYYY-MM-DD')" if tt == utils.TemporalType.TIMESTAMP: - return f"""TO_TIMESTAMP('{dttm.isoformat(timespec="microseconds")}', 'YYYY-MM-DD"T"HH24:MI:SS.ff6')""" # pylint: disable=line-too-long + return f"""TO_TIMESTAMP('{dttm + .isoformat(timespec="microseconds")}', 'YYYY-MM-DD"T"HH24:MI:SS.ff6')""" return None diff --git a/superset/db_engine_specs/hive.py b/superset/db_engine_specs/hive.py index 918128fa4f9f7..c762848cad3cb 100644 --- a/superset/db_engine_specs/hive.py +++ b/superset/db_engine_specs/hive.py @@ -41,7 +41,7 @@ if TYPE_CHECKING: # prevent circular imports - from superset.models.core import Database # pylint: disable=unused-import + from superset.models.core import Database QueryStatus = utils.QueryStatus config = app.config @@ -111,7 +111,7 @@ class HiveEngineSpec(PrestoEngineSpec): @classmethod def patch(cls) -> None: - from pyhive import hive # pylint: disable=no-name-in-module + from pyhive import hive from TCLIService import ( constants as patched_constants, TCLIService as patched_TCLIService, @@ -263,7 +263,8 @@ def convert_dttm(cls, target_type: str, dttm: datetime) -> Optional[str]: if tt == utils.TemporalType.DATE: return f"CAST('{dttm.date().isoformat()}' AS DATE)" if tt == utils.TemporalType.TIMESTAMP: - return f"""CAST('{dttm.isoformat(sep=" ", timespec="microseconds")}' AS TIMESTAMP)""" # pylint: disable=line-too-long + return f"""CAST('{dttm + .isoformat(sep=" ", timespec="microseconds")}' AS TIMESTAMP)""" return None @classmethod @@ -325,7 +326,7 @@ def handle_cursor( # pylint: disable=too-many-locals cls, cursor: Any, query: Query, session: Session ) -> None: """Updates progress information""" - from pyhive import hive # pylint: disable=no-name-in-module + from pyhive import hive unfinished_states = ( hive.ttypes.TOperationState.INITIALIZED_STATE, diff --git a/superset/db_engine_specs/kylin.py b/superset/db_engine_specs/kylin.py index 4a64091d155db..53c45c6a2ba60 100644 --- a/superset/db_engine_specs/kylin.py +++ b/superset/db_engine_specs/kylin.py @@ -47,5 +47,6 @@ def convert_dttm(cls, target_type: str, dttm: datetime) -> Optional[str]: if tt == utils.TemporalType.DATE: return f"CAST('{dttm.date().isoformat()}' AS DATE)" if tt == utils.TemporalType.TIMESTAMP: - return f"""CAST('{dttm.isoformat(sep=" ", timespec="seconds")}' AS TIMESTAMP)""" # pylint: disable=line-too-long + datetime_fomatted = dttm.isoformat(sep=" ", timespec="seconds") + return f"""CAST('{datetime_fomatted}' AS TIMESTAMP)""" return None