From cb3cd41dcd33af37b06e8ffc4d6d7ae1166d2d7f Mon Sep 17 00:00:00 2001 From: "Michael S. Molina" <70410625+michael-s-molina@users.noreply.github.com> Date: Wed, 29 Jun 2022 09:22:13 -0300 Subject: [PATCH] fix: Removes psycopg2 as a required dependency (#20543) * fix: Removes psycopg2 as a required dependency * Disables lint warning --- superset/db_engine_specs/postgres.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/superset/db_engine_specs/postgres.py b/superset/db_engine_specs/postgres.py index c5ffc79ee710..f9d450a3e9c9 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: