From ce973717aeaefaf808f926c4133ef2269bd97f80 Mon Sep 17 00:00:00 2001 From: Peter DeVita Date: Wed, 21 Feb 2024 17:37:05 -0500 Subject: [PATCH] Make processed types inclusive rather than exclusive, limit to just DIALECT_EXCLUDE --- databases/backends/common/records.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/databases/backends/common/records.py b/databases/backends/common/records.py index e6bb95f9..e963af50 100644 --- a/databases/backends/common/records.py +++ b/databases/backends/common/records.py @@ -63,14 +63,10 @@ def __getitem__(self, key: typing.Any) -> typing.Any: raw = self._row[idx] processor = datatype._cached_result_processor(self._dialect, None) - if self._dialect.name not in DIALECT_EXCLUDE: - if isinstance(datatype, JSON): - return raw - - if processor is not None and not isinstance( - raw, (datetime, date, time, enum.Enum) - ): - return processor(raw) + if self._dialect.name in DIALECT_EXCLUDE: + if processor is not None and isinstance(raw, (int, str, float)): + return processor(raw) + return raw def __iter__(self) -> typing.Iterator: