diff --git a/superset/db_engine_specs/postgres.py b/superset/db_engine_specs/postgres.py index c5ffc79ee7100..f9d450a3e9c9e 100644 --- a/superset/db_engine_specs/postgres.py +++ b/superset/db_engine_specs/postgres.py @@ -21,7 +21,6 @@ from typing import Any, Dict, List, Optional, Pattern, Tuple, TYPE_CHECKING from flask_babel import gettext as __ -from psycopg2.extensions import binary_types, string_types from sqlalchemy.dialects.postgresql import ARRAY, DOUBLE_PRECISION, ENUM, JSON from sqlalchemy.dialects.postgresql.base import PGInspector from sqlalchemy.types import String @@ -290,6 +289,9 @@ def get_column_spec( @classmethod def get_datatype(cls, type_code: Any) -> Optional[str]: + # pylint: disable=import-outside-toplevel + from psycopg2.extensions import binary_types, string_types + types = binary_types.copy() types.update(string_types) if type_code in types: