Skip to content

Commit 3e1a5fb

Browse files
committed
chore: read CSV in-memory
1 parent 4dbb6fe commit 3e1a5fb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

airbyte_cdk/sources/declarative/decoders/composite_raw_decoder.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import logging
66
from abc import ABC, abstractmethod
77
from dataclasses import dataclass
8-
from io import BufferedIOBase, TextIOWrapper
8+
from io import BufferedIOBase, BytesIO, TextIOWrapper
99
from typing import Any, Generator, MutableMapping, Optional
1010

1111
import orjson
@@ -124,7 +124,8 @@ def parse(
124124
"""
125125
Parse CSV data from decompressed bytes.
126126
"""
127-
text_data = TextIOWrapper(data, encoding=self.encoding) # type: ignore
127+
bytes_data = BytesIO(data.read())
128+
text_data = TextIOWrapper(bytes_data, encoding=self.encoding) # type: ignore
128129
reader = csv.DictReader(text_data, delimiter=self._get_delimiter() or ",")
129130
for row in reader:
130131
yield row

0 commit comments

Comments
 (0)