airbyte-source-iterable 0.5.1__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.
- {airbyte_source_iterable-0.5.1.dist-info → airbyte_source_iterable-0.5.1.dev202405100143.dist-info}/METADATA +26 -12
- {airbyte_source_iterable-0.5.1.dist-info → airbyte_source_iterable-0.5.1.dev202405100143.dist-info}/RECORD +5 -5
- source_iterable/components.py +8 -9
- {airbyte_source_iterable-0.5.1.dist-info → airbyte_source_iterable-0.5.1.dev202405100143.dist-info}/WHEEL +0 -0
- {airbyte_source_iterable-0.5.1.dist-info → airbyte_source_iterable-0.5.1.dev202405100143.dist-info}/entry_points.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: airbyte-source-iterable
|
3
|
-
Version: 0.5.1
|
3
|
+
Version: 0.5.1.dev202405100143
|
4
4
|
Summary: Source implementation for Iterable.
|
5
5
|
Home-page: https://airbyte.com
|
6
6
|
License: MIT
|
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.9
|
13
13
|
Classifier: Programming Language :: Python :: 3.10
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
15
|
-
Requires-Dist: airbyte-cdk (==0.
|
15
|
+
Requires-Dist: airbyte-cdk (==0.88.1)
|
16
16
|
Requires-Dist: pendulum (==2.1.2)
|
17
17
|
Requires-Dist: python-dateutil (==2.8.2)
|
18
18
|
Requires-Dist: requests (==2.31.0)
|
@@ -22,32 +22,33 @@ Description-Content-Type: text/markdown
|
|
22
22
|
|
23
23
|
# Iterable source connector
|
24
24
|
|
25
|
-
|
26
25
|
This is the repository for the Iterable source connector, written in Python.
|
27
26
|
For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.com/integrations/sources/iterable).
|
28
27
|
|
29
28
|
## Local development
|
30
29
|
|
31
30
|
### Prerequisites
|
32
|
-
* Python (~=3.9)
|
33
|
-
* Poetry (~=1.7) - installation instructions [here](https://python-poetry.org/docs/#installation)
|
34
31
|
|
32
|
+
- Python (~=3.9)
|
33
|
+
- Poetry (~=1.7) - installation instructions [here](https://python-poetry.org/docs/#installation)
|
35
34
|
|
36
35
|
### Installing the connector
|
36
|
+
|
37
37
|
From this connector directory, run:
|
38
|
+
|
38
39
|
```bash
|
39
40
|
poetry install --with dev
|
40
41
|
```
|
41
42
|
|
42
|
-
|
43
43
|
### Create credentials
|
44
|
+
|
44
45
|
**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.com/integrations/sources/iterable)
|
45
46
|
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_iterable/spec.yaml` file.
|
46
47
|
Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
|
47
48
|
See `sample_files/sample_config.json` for a sample config file.
|
48
49
|
|
49
|
-
|
50
50
|
### Locally running the connector
|
51
|
+
|
51
52
|
```
|
52
53
|
poetry run source-iterable spec
|
53
54
|
poetry run source-iterable check --config secrets/config.json
|
@@ -56,23 +57,28 @@ poetry run source-iterable read --config secrets/config.json --catalog sample_fi
|
|
56
57
|
```
|
57
58
|
|
58
59
|
### Running unit tests
|
60
|
+
|
59
61
|
To run unit tests locally, from the connector directory run:
|
62
|
+
|
60
63
|
```
|
61
64
|
poetry run pytest unit_tests
|
62
65
|
```
|
63
66
|
|
64
67
|
### Building the docker image
|
68
|
+
|
65
69
|
1. Install [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md)
|
66
70
|
2. Run the following command to build the docker image:
|
71
|
+
|
67
72
|
```bash
|
68
73
|
airbyte-ci connectors --name=source-iterable build
|
69
74
|
```
|
70
75
|
|
71
76
|
An image will be available on your host with the tag `airbyte/source-iterable:dev`.
|
72
77
|
|
73
|
-
|
74
78
|
### Running as a docker container
|
79
|
+
|
75
80
|
Then run any of the connector commands as follows:
|
81
|
+
|
76
82
|
```
|
77
83
|
docker run --rm airbyte/source-iterable:dev spec
|
78
84
|
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-iterable:dev check --config /secrets/config.json
|
@@ -81,18 +87,23 @@ docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integrat
|
|
81
87
|
```
|
82
88
|
|
83
89
|
### Running our CI test suite
|
90
|
+
|
84
91
|
You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
|
92
|
+
|
85
93
|
```bash
|
86
94
|
airbyte-ci connectors --name=source-iterable test
|
87
95
|
```
|
88
96
|
|
89
97
|
### Customizing acceptance Tests
|
98
|
+
|
90
99
|
Customize `acceptance-test-config.yml` file to configure acceptance tests. See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference) for more information.
|
91
100
|
If your connector requires to create or destroy resources for use during acceptance tests create fixtures for it and place them inside integration_tests/acceptance.py.
|
92
101
|
|
93
102
|
### Dependency Management
|
94
|
-
|
103
|
+
|
104
|
+
All of your dependencies should be managed via Poetry.
|
95
105
|
To add a new dependency, run:
|
106
|
+
|
96
107
|
```bash
|
97
108
|
poetry add <package-name>
|
98
109
|
```
|
@@ -100,14 +111,17 @@ poetry add <package-name>
|
|
100
111
|
Please commit the changes to `pyproject.toml` and `poetry.lock` files.
|
101
112
|
|
102
113
|
## Publishing a new version of the connector
|
114
|
+
|
103
115
|
You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
|
116
|
+
|
104
117
|
1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-iterable test`
|
105
|
-
2. Bump the connector version (please follow [semantic versioning for connectors](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#semantic-versioning-for-connectors)):
|
106
|
-
|
107
|
-
|
118
|
+
2. Bump the connector version (please follow [semantic versioning for connectors](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#semantic-versioning-for-connectors)):
|
119
|
+
- bump the `dockerImageTag` value in in `metadata.yaml`
|
120
|
+
- bump the `version` value in `pyproject.toml`
|
108
121
|
3. Make sure the `metadata.yaml` content is up to date.
|
109
122
|
4. Make sure the connector documentation and its changelog is up to date (`docs/integrations/sources/iterable.md`).
|
110
123
|
5. Create a Pull Request: use [our PR naming conventions](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#pull-request-title-convention).
|
111
124
|
6. Pat yourself on the back for being an awesome contributor.
|
112
125
|
7. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.
|
113
126
|
8. Once your PR is merged, the new version of the connector will be automatically published to Docker Hub and our connector registry.
|
127
|
+
|
@@ -1,5 +1,5 @@
|
|
1
1
|
source_iterable/__init__.py,sha256=8WKQT800ggxG1vGPoA_ZHUkozwEM7qMhGMhzEPCdA4o,65
|
2
|
-
source_iterable/components.py,sha256=
|
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.dist-info/METADATA,sha256=
|
29
|
-
airbyte_source_iterable-0.5.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
30
|
-
airbyte_source_iterable-0.5.1.dist-info/entry_points.txt,sha256=pjzrNtsOX3jW37IK0U5pSmLiraiuLTPr5aB5-hBXpAo,59
|
31
|
-
airbyte_source_iterable-0.5.1.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,,
|
source_iterable/components.py
CHANGED
@@ -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
|
-
|
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) ->
|
23
|
-
|
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) ->
|
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}
|
File without changes
|
File without changes
|