fix(postgres): remove redundant tz factory (#17713)
* fix(postgres): remove redundant tz factory * lint
This commit is contained in:
parent
4b969710e4
commit
6a7e6490a9
|
|
@ -32,7 +32,6 @@ from typing import (
|
|||
)
|
||||
|
||||
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
|
||||
|
|
@ -50,12 +49,6 @@ if TYPE_CHECKING:
|
|||
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'
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue