Skip to content

Commit

Permalink
Make processed types inclusive rather than exclusive, limit to just D…
Browse files Browse the repository at this point in the history
…IALECT_EXCLUDE
  • Loading branch information
pmdevita committed Feb 21, 2024
1 parent 61dac27 commit ce97371
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions databases/backends/common/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit ce97371

Please sign in to comment.