airbyte-source-iterable 0.5.1.dev202405100053__py3-none-any.whl → 0.5.1.dev202405100143__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-source-iterable
3
- Version: 0.5.1.dev202405100053
3
+ Version: 0.5.1.dev202405100143
4
4
  Summary: Source implementation for Iterable.
5
5
  Home-page: https://airbyte.com
6
6
  License: MIT
@@ -1,5 +1,5 @@
1
1
  source_iterable/__init__.py,sha256=8WKQT800ggxG1vGPoA_ZHUkozwEM7qMhGMhzEPCdA4o,65
2
- source_iterable/components.py,sha256=dHp23THc43TmogP_tCxcv12mAgZSRs5fKir2ckr4hHI,1374
2
+ source_iterable/components.py,sha256=dMNoGz58C49sWvvJXP57arccWa1z9BHyhMOj2_KDUTU,1374
3
3
  source_iterable/manifest.yaml,sha256=uO7z-bIU6CtGms6IsLwjyZ-cb3tVY-vLUMLOZGkZDts,13996
4
4
  source_iterable/run.py,sha256=-Bvz772Z7iJWExDoJS7chxv725hG4e9e5Engrtp66iE,236
5
5
  source_iterable/schemas/campaigns.json,sha256=FONoPuz_4aRat8OZzhj7BcHFAqetpBYUDmOZfroCu7I,2494
@@ -25,7 +25,7 @@ source_iterable/source.py,sha256=AhZQ4L54VTo6jf2QltvFCqDNgqaPSEKCfR0GInCLEEc,453
25
25
  source_iterable/spec.json,sha256=y5_YFTkPPtxjvzGtaZZql90Tc37fyZZpQKXFGPL_cYE,1009
26
26
  source_iterable/streams.py,sha256=ZEC8IqBrTeD2oYOvLL51E62iOsIOK3jiTN7pLI-CwRs,19468
27
27
  source_iterable/utils.py,sha256=2oM8AjBZXs9nTG_PhSWmxBWEmp-w-tWFaxQQvAfUuMM,649
28
- airbyte_source_iterable-0.5.1.dev202405100053.dist-info/METADATA,sha256=AY7QJ5n1HwDh3bm6pWTmfMdC-feRX7Q5g4y4O8ITFpw,5378
29
- airbyte_source_iterable-0.5.1.dev202405100053.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
30
- airbyte_source_iterable-0.5.1.dev202405100053.dist-info/entry_points.txt,sha256=pjzrNtsOX3jW37IK0U5pSmLiraiuLTPr5aB5-hBXpAo,59
31
- airbyte_source_iterable-0.5.1.dev202405100053.dist-info/RECORD,,
28
+ airbyte_source_iterable-0.5.1.dev202405100143.dist-info/METADATA,sha256=RdocwuPkwN0QYxbql02qCcFKd3A9Ym-KQ6R0etHEf0s,5378
29
+ airbyte_source_iterable-0.5.1.dev202405100143.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
30
+ airbyte_source_iterable-0.5.1.dev202405100143.dist-info/entry_points.txt,sha256=pjzrNtsOX3jW37IK0U5pSmLiraiuLTPr5aB5-hBXpAo,59
31
+ airbyte_source_iterable-0.5.1.dev202405100143.dist-info/RECORD,,
@@ -7,6 +7,7 @@ from dataclasses import dataclass
7
7
  from io import StringIO
8
8
 
9
9
  import requests
10
+ from typing import Iterable
10
11
  from airbyte_cdk.sources.declarative.extractors.dpath_extractor import DpathExtractor
11
12
  from airbyte_cdk.sources.declarative.types import Config, Record, StreamSlice, StreamState
12
13
 
@@ -14,28 +15,26 @@ from airbyte_cdk.sources.declarative.types import Config, Record, StreamSlice, S
14
15
  @dataclass
15
16
  class XJsonRecordExtractor(DpathExtractor):
16
17
  def extract_records(self, response: requests.Response) -> list[Record]:
17
- return [json.loads(record) for record in response.iter_lines()]
18
+ for record in response.iter_lines():
19
+ yield json.loads(record)
18
20
 
19
21
 
20
22
  @dataclass
21
23
  class ListUsersRecordExtractor(DpathExtractor):
22
- def extract_records(self, response: requests.Response) -> list[Record]:
23
- return [{"email": record.decode()} for record in response.iter_lines()]
24
+ def extract_records(self, response: requests.Response) -> Iterable[Record]:
25
+ for record in response.iter_lines():
26
+ yield {"email": record.decode()}
24
27
 
25
28
 
26
29
  @dataclass
27
30
  class EventsRecordExtractor(DpathExtractor):
28
31
  common_fields = ("itblInternal", "_type", "createdAt", "email")
29
32
 
30
- def extract_records(self, response: requests.Response) -> list[Record]:
33
+ def extract_records(self, response: requests.Response) -> Iterable[Record]:
31
34
  jsonl_records = StringIO(response.text)
32
- records = []
33
35
  for record in jsonl_records:
34
36
  record_dict = json.loads(record)
35
37
  record_dict_common_fields = {}
36
38
  for field in self.common_fields:
37
39
  record_dict_common_fields[field] = record_dict.pop(field, None)
38
-
39
- records.append({**record_dict_common_fields, "data": record_dict})
40
-
41
- return records
40
+ yield {**record_dict_common_fields, "data": record_dict}