Skip to content

Commit

Permalink
fix(postgres): remove redundant tz factory (#17713)
Browse files Browse the repository at this point in the history
* fix(postgres): remove redundant tz factory

* lint
  • Loading branch information
villebro committed Dec 10, 2021
1 parent 4b96971 commit 6a7e649
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions superset/db_engine_specs/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
)

from flask_babel import gettext as __
from pytz import _FixedOffset
from sqlalchemy.dialects.postgresql import ARRAY, DOUBLE_PRECISION, ENUM, JSON
from sqlalchemy.dialects.postgresql.base import PGInspector
from sqlalchemy.types import String, TypeEngine
Expand All @@ -50,12 +49,6 @@
logger = logging.getLogger()


# Replace psycopg2.tz.FixedOffsetTimezone with pytz, which is serializable by PyArrow
# https://github.com/stub42/pytz/blob/b70911542755aeeea7b5a9e066df5e1c87e8f2c8/src/pytz/reference.py#L25
class FixedOffsetTimezone(_FixedOffset):
pass


# Regular expressions to catch custom errors
CONNECTION_INVALID_USERNAME_REGEX = re.compile(
'role "(?P<username>.*?)" does not exist'
Expand Down Expand Up @@ -168,7 +161,6 @@ class PostgresBaseEngineSpec(BaseEngineSpec):
def fetch_data(
cls, cursor: Any, limit: Optional[int] = None
) -> List[Tuple[Any, ...]]:
cursor.tzinfo_factory = FixedOffsetTimezone
if not cursor.description:
return []
return super().fetch_data(cursor, limit)
Expand Down

0 comments on commit 6a7e649

Please sign in to comment.