airbyte-source-hardcoded-records 0.0.1__tar.gz
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_hardcoded_records-0.0.1/PKG-INFO +125 -0
- airbyte_source_hardcoded_records-0.0.1/README.md +104 -0
- airbyte_source_hardcoded_records-0.0.1/pyproject.toml +32 -0
- airbyte_source_hardcoded_records-0.0.1/source_hardcoded_records/__init__.py +8 -0
- airbyte_source_hardcoded_records-0.0.1/source_hardcoded_records/run.py +16 -0
- airbyte_source_hardcoded_records-0.0.1/source_hardcoded_records/schemas/customers.json +308 -0
- airbyte_source_hardcoded_records-0.0.1/source_hardcoded_records/schemas/dummy_fields.json +11 -0
- airbyte_source_hardcoded_records-0.0.1/source_hardcoded_records/schemas/products.json +21 -0
- airbyte_source_hardcoded_records-0.0.1/source_hardcoded_records/source.py +25 -0
- airbyte_source_hardcoded_records-0.0.1/source_hardcoded_records/spec.json +20 -0
- airbyte_source_hardcoded_records-0.0.1/source_hardcoded_records/streams.py +123 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: airbyte-source-hardcoded-records
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Source implementation for hardcoded recprds.
|
|
5
|
+
Home-page: https://airbyte.com
|
|
6
|
+
License: MIT
|
|
7
|
+
Author: Airbyte
|
|
8
|
+
Author-email: contact@airbyte.io
|
|
9
|
+
Requires-Python: >=3.9,<4.0
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Requires-Dist: airbyte-cdk (>=3.0,<4.0)
|
|
17
|
+
Project-URL: Documentation, https://docs.airbyte.com/integrations/sources/hardcoded-records
|
|
18
|
+
Project-URL: Repository, https://github.com/airbytehq/airbyte
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
# Hardcoded Records source connector
|
|
22
|
+
|
|
23
|
+
This is the repository for the Hardcoded Records source connector, written in Python.
|
|
24
|
+
For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.com/integrations/sources/hardcoded-records).
|
|
25
|
+
|
|
26
|
+
## Local development
|
|
27
|
+
|
|
28
|
+
### Prerequisites
|
|
29
|
+
|
|
30
|
+
- Python (~=3.9)
|
|
31
|
+
- Poetry (~=1.7) - installation instructions [here](https://python-poetry.org/docs/#installation)
|
|
32
|
+
|
|
33
|
+
### Installing the connector
|
|
34
|
+
|
|
35
|
+
From this connector directory, run:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
poetry install --with dev
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Create credentials
|
|
42
|
+
|
|
43
|
+
**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.com/integrations/sources/hardcoded-records)
|
|
44
|
+
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_hardcoded_records/spec.yaml` file.
|
|
45
|
+
Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
|
|
46
|
+
See `sample_files/sample_config.json` for a sample config file.
|
|
47
|
+
|
|
48
|
+
### Locally running the connector
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
poetry run source-hardcoded-records spec
|
|
52
|
+
poetry run source-hardcoded-records check --config secrets/config.json
|
|
53
|
+
poetry run source-hardcoded-records discover --config secrets/config.json
|
|
54
|
+
poetry run source-hardcoded-records read --config secrets/config.json --catalog sample_files/configured_catalog.json
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Running unit tests
|
|
58
|
+
|
|
59
|
+
To run unit tests locally, from the connector directory run:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
poetry run pytest unit_tests
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Building the docker image
|
|
66
|
+
|
|
67
|
+
1. Install [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md)
|
|
68
|
+
2. Run the following command to build the docker image:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
airbyte-ci connectors --name=source-hardcoded-records build
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
An image will be available on your host with the tag `airbyte/source-hardcoded-records:dev`.
|
|
75
|
+
|
|
76
|
+
### Running as a docker container
|
|
77
|
+
|
|
78
|
+
Then run any of the connector commands as follows:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
docker run --rm airbyte/source-hardcoded-records:dev spec
|
|
82
|
+
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-hardcoded-records:dev check --config /secrets/config.json
|
|
83
|
+
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-hardcoded-records:dev discover --config /secrets/config.json
|
|
84
|
+
docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-hardcoded-records:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Running our CI test suite
|
|
88
|
+
|
|
89
|
+
You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
airbyte-ci connectors --name=source-hardcoded-records test
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Customizing acceptance Tests
|
|
96
|
+
|
|
97
|
+
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.
|
|
98
|
+
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.
|
|
99
|
+
|
|
100
|
+
### Dependency Management
|
|
101
|
+
|
|
102
|
+
All of your dependencies should be managed via Poetry.
|
|
103
|
+
To add a new dependency, run:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
poetry add <package-name>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Please commit the changes to `pyproject.toml` and `poetry.lock` files.
|
|
110
|
+
|
|
111
|
+
## Publishing a new version of the connector
|
|
112
|
+
|
|
113
|
+
You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
|
|
114
|
+
|
|
115
|
+
1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-hardcoded-records test`
|
|
116
|
+
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)):
|
|
117
|
+
- bump the `dockerImageTag` value in in `metadata.yaml`
|
|
118
|
+
- bump the `version` value in `pyproject.toml`
|
|
119
|
+
3. Make sure the `metadata.yaml` content is up to date.
|
|
120
|
+
4. Make sure the connector documentation and its changelog is up to date (`docs/integrations/sources/hardcoded-records.md`).
|
|
121
|
+
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).
|
|
122
|
+
6. Pat yourself on the back for being an awesome contributor.
|
|
123
|
+
7. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.
|
|
124
|
+
8. Once your PR is merged, the new version of the connector will be automatically published to Docker Hub and our connector registry.
|
|
125
|
+
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Hardcoded Records source connector
|
|
2
|
+
|
|
3
|
+
This is the repository for the Hardcoded Records source connector, written in Python.
|
|
4
|
+
For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.com/integrations/sources/hardcoded-records).
|
|
5
|
+
|
|
6
|
+
## Local development
|
|
7
|
+
|
|
8
|
+
### Prerequisites
|
|
9
|
+
|
|
10
|
+
- Python (~=3.9)
|
|
11
|
+
- Poetry (~=1.7) - installation instructions [here](https://python-poetry.org/docs/#installation)
|
|
12
|
+
|
|
13
|
+
### Installing the connector
|
|
14
|
+
|
|
15
|
+
From this connector directory, run:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
poetry install --with dev
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Create credentials
|
|
22
|
+
|
|
23
|
+
**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.com/integrations/sources/hardcoded-records)
|
|
24
|
+
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_hardcoded_records/spec.yaml` file.
|
|
25
|
+
Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
|
|
26
|
+
See `sample_files/sample_config.json` for a sample config file.
|
|
27
|
+
|
|
28
|
+
### Locally running the connector
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
poetry run source-hardcoded-records spec
|
|
32
|
+
poetry run source-hardcoded-records check --config secrets/config.json
|
|
33
|
+
poetry run source-hardcoded-records discover --config secrets/config.json
|
|
34
|
+
poetry run source-hardcoded-records read --config secrets/config.json --catalog sample_files/configured_catalog.json
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Running unit tests
|
|
38
|
+
|
|
39
|
+
To run unit tests locally, from the connector directory run:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
poetry run pytest unit_tests
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Building the docker image
|
|
46
|
+
|
|
47
|
+
1. Install [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md)
|
|
48
|
+
2. Run the following command to build the docker image:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
airbyte-ci connectors --name=source-hardcoded-records build
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
An image will be available on your host with the tag `airbyte/source-hardcoded-records:dev`.
|
|
55
|
+
|
|
56
|
+
### Running as a docker container
|
|
57
|
+
|
|
58
|
+
Then run any of the connector commands as follows:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
docker run --rm airbyte/source-hardcoded-records:dev spec
|
|
62
|
+
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-hardcoded-records:dev check --config /secrets/config.json
|
|
63
|
+
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-hardcoded-records:dev discover --config /secrets/config.json
|
|
64
|
+
docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-hardcoded-records:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Running our CI test suite
|
|
68
|
+
|
|
69
|
+
You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
airbyte-ci connectors --name=source-hardcoded-records test
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Customizing acceptance Tests
|
|
76
|
+
|
|
77
|
+
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.
|
|
78
|
+
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.
|
|
79
|
+
|
|
80
|
+
### Dependency Management
|
|
81
|
+
|
|
82
|
+
All of your dependencies should be managed via Poetry.
|
|
83
|
+
To add a new dependency, run:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
poetry add <package-name>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Please commit the changes to `pyproject.toml` and `poetry.lock` files.
|
|
90
|
+
|
|
91
|
+
## Publishing a new version of the connector
|
|
92
|
+
|
|
93
|
+
You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
|
|
94
|
+
|
|
95
|
+
1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-hardcoded-records test`
|
|
96
|
+
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)):
|
|
97
|
+
- bump the `dockerImageTag` value in in `metadata.yaml`
|
|
98
|
+
- bump the `version` value in `pyproject.toml`
|
|
99
|
+
3. Make sure the `metadata.yaml` content is up to date.
|
|
100
|
+
4. Make sure the connector documentation and its changelog is up to date (`docs/integrations/sources/hardcoded-records.md`).
|
|
101
|
+
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).
|
|
102
|
+
6. Pat yourself on the back for being an awesome contributor.
|
|
103
|
+
7. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.
|
|
104
|
+
8. Once your PR is merged, the new version of the connector will be automatically published to Docker Hub and our connector registry.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = [
|
|
3
|
+
"poetry-core>=1.0.0",
|
|
4
|
+
]
|
|
5
|
+
build-backend = "poetry.core.masonry.api"
|
|
6
|
+
|
|
7
|
+
[tool.poetry]
|
|
8
|
+
version = "0.0.1"
|
|
9
|
+
name = "airbyte-source-hardcoded-records"
|
|
10
|
+
description = "Source implementation for hardcoded recprds."
|
|
11
|
+
authors = [
|
|
12
|
+
"Airbyte <contact@airbyte.io>",
|
|
13
|
+
]
|
|
14
|
+
license = "MIT"
|
|
15
|
+
readme = "README.md"
|
|
16
|
+
documentation = "https://docs.airbyte.com/integrations/sources/hardcoded-records"
|
|
17
|
+
homepage = "https://airbyte.com"
|
|
18
|
+
repository = "https://github.com/airbytehq/airbyte"
|
|
19
|
+
packages = [
|
|
20
|
+
{ include = "source_hardcoded_records" },
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[tool.poetry.dependencies]
|
|
24
|
+
python = "^3.9,<4.0"
|
|
25
|
+
airbyte-cdk = "^3.0"
|
|
26
|
+
|
|
27
|
+
[tool.poetry.scripts]
|
|
28
|
+
source-hardcoded-records = "source_hardcoded_records.run:run"
|
|
29
|
+
|
|
30
|
+
[tool.poetry.group.dev.dependencies]
|
|
31
|
+
pytest-mock = "^3.6.1"
|
|
32
|
+
pytest = "^6.2"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
from airbyte_cdk.entrypoint import launch
|
|
7
|
+
from source_hardcoded_records import SourceHardcodedRecords
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def run():
|
|
11
|
+
source = SourceHardcodedRecords()
|
|
12
|
+
launch(source, sys.argv[1:])
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
if __name__ == "__main__":
|
|
16
|
+
run()
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": ["null", "object"],
|
|
3
|
+
"additionalProperties": true,
|
|
4
|
+
"properties": {
|
|
5
|
+
"last_order_name": {
|
|
6
|
+
"description": "Name of the customer's last order.",
|
|
7
|
+
"type": ["null", "string"]
|
|
8
|
+
},
|
|
9
|
+
"currency": {
|
|
10
|
+
"description": "Currency associated with the customer.",
|
|
11
|
+
"type": ["null", "string"]
|
|
12
|
+
},
|
|
13
|
+
"email": {
|
|
14
|
+
"description": "Customer's email address.",
|
|
15
|
+
"type": ["null", "string"]
|
|
16
|
+
},
|
|
17
|
+
"multipass_identifier": {
|
|
18
|
+
"description": "Multipass identifier for the customer.",
|
|
19
|
+
"type": ["null", "string"]
|
|
20
|
+
},
|
|
21
|
+
"shop_url": {
|
|
22
|
+
"description": "URL of the customer's associated shop.",
|
|
23
|
+
"type": ["null", "string"]
|
|
24
|
+
},
|
|
25
|
+
"default_address": {
|
|
26
|
+
"description": "Customer's default address",
|
|
27
|
+
"type": ["null", "object"],
|
|
28
|
+
"properties": {
|
|
29
|
+
"city": {
|
|
30
|
+
"description": "City where the customer's default address is located.",
|
|
31
|
+
"type": ["null", "string"]
|
|
32
|
+
},
|
|
33
|
+
"address1": {
|
|
34
|
+
"description": "First line of customer's default address.",
|
|
35
|
+
"type": ["null", "string"]
|
|
36
|
+
},
|
|
37
|
+
"zip": {
|
|
38
|
+
"description": "Postal or ZIP code of the customer's default address.",
|
|
39
|
+
"type": ["null", "string"]
|
|
40
|
+
},
|
|
41
|
+
"id": {
|
|
42
|
+
"description": "Unique identifier for the default address.",
|
|
43
|
+
"type": ["null", "integer"]
|
|
44
|
+
},
|
|
45
|
+
"country_name": {
|
|
46
|
+
"description": "Name of the country for the customer's default address.",
|
|
47
|
+
"type": ["null", "string"]
|
|
48
|
+
},
|
|
49
|
+
"province": {
|
|
50
|
+
"description": "Province or state where the customer's default address is located.",
|
|
51
|
+
"type": ["null", "string"]
|
|
52
|
+
},
|
|
53
|
+
"phone": {
|
|
54
|
+
"description": "Customer's phone number associated with the default address.",
|
|
55
|
+
"type": ["null", "string"]
|
|
56
|
+
},
|
|
57
|
+
"country": {
|
|
58
|
+
"description": "Country of the customer's default address.",
|
|
59
|
+
"type": ["null", "string"]
|
|
60
|
+
},
|
|
61
|
+
"first_name": {
|
|
62
|
+
"description": "Customer's first name associated with the default address.",
|
|
63
|
+
"type": ["null", "string"]
|
|
64
|
+
},
|
|
65
|
+
"customer_id": {
|
|
66
|
+
"description": "Unique identifier for the customer.",
|
|
67
|
+
"type": ["null", "integer"]
|
|
68
|
+
},
|
|
69
|
+
"default": {
|
|
70
|
+
"description": "Indicates if this is the default address for the customer.",
|
|
71
|
+
"type": ["null", "boolean"]
|
|
72
|
+
},
|
|
73
|
+
"last_name": {
|
|
74
|
+
"description": "Customer's last name associated with the default address.",
|
|
75
|
+
"type": ["null", "string"]
|
|
76
|
+
},
|
|
77
|
+
"country_code": {
|
|
78
|
+
"description": "Country code of the customer's default address.",
|
|
79
|
+
"type": ["null", "string"]
|
|
80
|
+
},
|
|
81
|
+
"name": {
|
|
82
|
+
"description": "Full name associated with the default address.",
|
|
83
|
+
"type": ["null", "string"]
|
|
84
|
+
},
|
|
85
|
+
"province_code": {
|
|
86
|
+
"description": "Province or state code of the customer's default address.",
|
|
87
|
+
"type": ["null", "string"]
|
|
88
|
+
},
|
|
89
|
+
"address2": {
|
|
90
|
+
"description": "Second line of customer's default address.",
|
|
91
|
+
"type": ["null", "string"]
|
|
92
|
+
},
|
|
93
|
+
"company": {
|
|
94
|
+
"description": "Customer's company name associated with the default address.",
|
|
95
|
+
"type": ["null", "string"]
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"email_marketing_consent": {
|
|
100
|
+
"description": "Indicates if the customer has consented to receive marketing emails",
|
|
101
|
+
"type": ["null", "object"],
|
|
102
|
+
"properties": {
|
|
103
|
+
"consent_updated_at": {
|
|
104
|
+
"description": "Timestamp when the email marketing consent was last updated.",
|
|
105
|
+
"type": ["null", "string"],
|
|
106
|
+
"format": "date-time"
|
|
107
|
+
},
|
|
108
|
+
"opt_in_level": {
|
|
109
|
+
"description": "Level of opt-in for email marketing.",
|
|
110
|
+
"type": ["null", "string"]
|
|
111
|
+
},
|
|
112
|
+
"state": {
|
|
113
|
+
"description": "Current state of email marketing consent.",
|
|
114
|
+
"type": ["null", "string"]
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"orders_count": {
|
|
119
|
+
"description": "Total number of orders placed by the customer.",
|
|
120
|
+
"type": ["null", "integer"]
|
|
121
|
+
},
|
|
122
|
+
"state": {
|
|
123
|
+
"description": "Current state or status of the customer.",
|
|
124
|
+
"type": ["null", "string"]
|
|
125
|
+
},
|
|
126
|
+
"verified_email": {
|
|
127
|
+
"description": "Indicates if the customer's email address has been verified.",
|
|
128
|
+
"type": ["null", "boolean"]
|
|
129
|
+
},
|
|
130
|
+
"total_spent": {
|
|
131
|
+
"description": "Total amount spent by the customer.",
|
|
132
|
+
"type": ["null", "number"]
|
|
133
|
+
},
|
|
134
|
+
"last_order_id": {
|
|
135
|
+
"description": "Unique identifier for the customer's last order.",
|
|
136
|
+
"type": ["null", "integer"]
|
|
137
|
+
},
|
|
138
|
+
"first_name": {
|
|
139
|
+
"description": "Customer's first name.",
|
|
140
|
+
"type": ["null", "string"]
|
|
141
|
+
},
|
|
142
|
+
"updated_at": {
|
|
143
|
+
"description": "Timestamp when the customer data was last updated.",
|
|
144
|
+
"type": ["null", "string"],
|
|
145
|
+
"format": "date-time"
|
|
146
|
+
},
|
|
147
|
+
"note": {
|
|
148
|
+
"description": "Additional notes or comments related to the customer.",
|
|
149
|
+
"type": ["null", "string"]
|
|
150
|
+
},
|
|
151
|
+
"phone": {
|
|
152
|
+
"description": "Customer's phone number.",
|
|
153
|
+
"type": ["null", "string"]
|
|
154
|
+
},
|
|
155
|
+
"admin_graphql_api_id": {
|
|
156
|
+
"description": "Unique identifier for the customer in the Admin GraphQL API.",
|
|
157
|
+
"type": ["null", "string"]
|
|
158
|
+
},
|
|
159
|
+
"addresses": {
|
|
160
|
+
"description": "List of addresses associated with the customer",
|
|
161
|
+
"type": ["null", "array"],
|
|
162
|
+
"items": {
|
|
163
|
+
"type": ["null", "object"],
|
|
164
|
+
"properties": {
|
|
165
|
+
"city": {
|
|
166
|
+
"description": "City where the customer is located.",
|
|
167
|
+
"type": ["null", "string"]
|
|
168
|
+
},
|
|
169
|
+
"address1": {
|
|
170
|
+
"description": "First line of customer's address.",
|
|
171
|
+
"type": ["null", "string"]
|
|
172
|
+
},
|
|
173
|
+
"zip": {
|
|
174
|
+
"description": "Postal or ZIP code of the customer's address.",
|
|
175
|
+
"type": ["null", "string"]
|
|
176
|
+
},
|
|
177
|
+
"id": {
|
|
178
|
+
"description": "Unique identifier for the address.",
|
|
179
|
+
"type": ["null", "integer"]
|
|
180
|
+
},
|
|
181
|
+
"country_name": {
|
|
182
|
+
"description": "Name of the customer's country.",
|
|
183
|
+
"type": ["null", "string"]
|
|
184
|
+
},
|
|
185
|
+
"province": {
|
|
186
|
+
"description": "Province or state where the customer is located.",
|
|
187
|
+
"type": ["null", "string"]
|
|
188
|
+
},
|
|
189
|
+
"phone": {
|
|
190
|
+
"description": "Customer's phone number.",
|
|
191
|
+
"type": ["null", "string"]
|
|
192
|
+
},
|
|
193
|
+
"country": {
|
|
194
|
+
"description": "Customer's country.",
|
|
195
|
+
"type": ["null", "string"]
|
|
196
|
+
},
|
|
197
|
+
"first_name": {
|
|
198
|
+
"description": "Customer's first name.",
|
|
199
|
+
"type": ["null", "string"]
|
|
200
|
+
},
|
|
201
|
+
"customer_id": {
|
|
202
|
+
"description": "Unique identifier for the customer.",
|
|
203
|
+
"type": ["null", "integer"]
|
|
204
|
+
},
|
|
205
|
+
"default": {
|
|
206
|
+
"description": "Indicates if this address is the default address for the customer.",
|
|
207
|
+
"type": ["null", "boolean"]
|
|
208
|
+
},
|
|
209
|
+
"last_name": {
|
|
210
|
+
"description": "Customer's last name.",
|
|
211
|
+
"type": ["null", "string"]
|
|
212
|
+
},
|
|
213
|
+
"country_code": {
|
|
214
|
+
"description": "Country code of the customer's country.",
|
|
215
|
+
"type": ["null", "string"]
|
|
216
|
+
},
|
|
217
|
+
"name": {
|
|
218
|
+
"description": "Full name associated with the address.",
|
|
219
|
+
"type": ["null", "string"]
|
|
220
|
+
},
|
|
221
|
+
"province_code": {
|
|
222
|
+
"description": "Province or state code.",
|
|
223
|
+
"type": ["null", "string"]
|
|
224
|
+
},
|
|
225
|
+
"address2": {
|
|
226
|
+
"description": "Second line of customer's address.",
|
|
227
|
+
"type": ["null", "string"]
|
|
228
|
+
},
|
|
229
|
+
"company": {
|
|
230
|
+
"description": "Customer's company name.",
|
|
231
|
+
"type": ["null", "string"]
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
"last_name": {
|
|
237
|
+
"description": "Customer's last name.",
|
|
238
|
+
"type": ["null", "string"]
|
|
239
|
+
},
|
|
240
|
+
"tags": {
|
|
241
|
+
"description": "Tags associated with the customer for categorization.",
|
|
242
|
+
"type": ["null", "string"]
|
|
243
|
+
},
|
|
244
|
+
"tax_exempt": {
|
|
245
|
+
"description": "Indicates if the customer is tax exempt.",
|
|
246
|
+
"type": ["null", "boolean"]
|
|
247
|
+
},
|
|
248
|
+
"id": {
|
|
249
|
+
"description": "Unique identifier for the customer.",
|
|
250
|
+
"type": ["null", "integer"]
|
|
251
|
+
},
|
|
252
|
+
"accepts_marketing": {
|
|
253
|
+
"description": "Indicates if the customer has agreed to receive marketing materials.",
|
|
254
|
+
"type": ["null", "boolean"]
|
|
255
|
+
},
|
|
256
|
+
"accepts_marketing_updated_at": {
|
|
257
|
+
"description": "Timestamp when the marketing consent status was last updated.",
|
|
258
|
+
"anyOf": [
|
|
259
|
+
{
|
|
260
|
+
"type": "string",
|
|
261
|
+
"format": "date-time"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"type": "string"
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"type": "null"
|
|
268
|
+
}
|
|
269
|
+
]
|
|
270
|
+
},
|
|
271
|
+
"created_at": {
|
|
272
|
+
"description": "Timestamp when the customer was created.",
|
|
273
|
+
"type": ["null", "string"],
|
|
274
|
+
"format": "date-time"
|
|
275
|
+
},
|
|
276
|
+
"sms_marketing_consent": {
|
|
277
|
+
"description": "Indicates if the customer has consented to receive marketing SMS messages",
|
|
278
|
+
"type": ["null", "object"],
|
|
279
|
+
"properties": {
|
|
280
|
+
"consent_collected_from": {
|
|
281
|
+
"description": "Source from which SMS marketing consent was collected.",
|
|
282
|
+
"type": ["null", "string"]
|
|
283
|
+
},
|
|
284
|
+
"consent_updated_at": {
|
|
285
|
+
"description": "Timestamp when the SMS marketing consent was last updated.",
|
|
286
|
+
"type": ["null", "string"],
|
|
287
|
+
"format": "date-time"
|
|
288
|
+
},
|
|
289
|
+
"opt_in_level": {
|
|
290
|
+
"description": "Level of opt-in for SMS marketing.",
|
|
291
|
+
"type": ["null", "string"]
|
|
292
|
+
},
|
|
293
|
+
"state": {
|
|
294
|
+
"description": "Current state of SMS marketing consent.",
|
|
295
|
+
"type": ["null", "string"]
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
"tax_exemptions": {
|
|
300
|
+
"description": "Information about tax exemptions for the customer.",
|
|
301
|
+
"type": ["null", "string"]
|
|
302
|
+
},
|
|
303
|
+
"marketing_opt_in_level": {
|
|
304
|
+
"description": "Level of opt-in for marketing activities.",
|
|
305
|
+
"type": ["null", "string"]
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"field1": { "type": "string" },
|
|
6
|
+
"field2": { "type": "string" },
|
|
7
|
+
"field3": { "type": "string" },
|
|
8
|
+
"field4": { "type": "string" },
|
|
9
|
+
"field5": { "type": "string" }
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"id": { "type": "integer" },
|
|
6
|
+
"make": { "type": "string" },
|
|
7
|
+
"model": { "type": "string" },
|
|
8
|
+
"year": { "type": "integer" },
|
|
9
|
+
"price": { "type": "number" },
|
|
10
|
+
"created_at": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"format": "date-time",
|
|
13
|
+
"airbyte_type": "timestamp_with_timezone"
|
|
14
|
+
},
|
|
15
|
+
"updated_at": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"format": "date-time",
|
|
18
|
+
"airbyte_type": "timestamp_with_timezone"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import logging
|
|
5
|
+
from typing import Any, List, Mapping, Tuple
|
|
6
|
+
|
|
7
|
+
from airbyte_cdk.sources import AbstractSource
|
|
8
|
+
from airbyte_cdk.sources.streams import Stream
|
|
9
|
+
|
|
10
|
+
from .streams import Customers, DummyFields, Products
|
|
11
|
+
|
|
12
|
+
DEFAULT_COUNT = 1_000
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class SourceHardcodedRecords(AbstractSource):
|
|
16
|
+
def check_connection(self, logger: logging.Logger, config: Mapping[str, Any]) -> Tuple[bool, Any]:
|
|
17
|
+
if type(config["count"]) == int or type(config["count"]) == float:
|
|
18
|
+
return True, None
|
|
19
|
+
else:
|
|
20
|
+
return False, "Count option is missing"
|
|
21
|
+
|
|
22
|
+
def streams(self, config: Mapping[str, Any]) -> List[Stream]:
|
|
23
|
+
count: int = config["count"] if "count" in config else DEFAULT_COUNT
|
|
24
|
+
|
|
25
|
+
return [Products(count), Customers(count), DummyFields(count)]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"documentationUrl": "https://docs.airbyte.com/integrations/sources/hardcoded-records",
|
|
3
|
+
"connectionSpecification": {
|
|
4
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5
|
+
"title": "Hardcoded Records Source Spec",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [],
|
|
8
|
+
"additionalProperties": true,
|
|
9
|
+
"properties": {
|
|
10
|
+
"count": {
|
|
11
|
+
"title": "Count",
|
|
12
|
+
"description": "How many records per stream should be generated",
|
|
13
|
+
"type": "integer",
|
|
14
|
+
"minimum": 1,
|
|
15
|
+
"default": 1000,
|
|
16
|
+
"order": 0
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
from abc import ABC
|
|
5
|
+
from typing import Any, Iterable, Mapping
|
|
6
|
+
|
|
7
|
+
from airbyte_cdk.sources.streams import Stream
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class HardcodedStream(Stream, ABC):
|
|
11
|
+
primary_key = None
|
|
12
|
+
sample_record = None
|
|
13
|
+
|
|
14
|
+
def __init__(self, count: int, **kwargs):
|
|
15
|
+
super().__init__(**kwargs)
|
|
16
|
+
self.count = count
|
|
17
|
+
|
|
18
|
+
def read_records(self, **kwargs) -> Iterable[Mapping[str, Any]]:
|
|
19
|
+
""" """
|
|
20
|
+
for _ in range(self.count):
|
|
21
|
+
yield self.sample_record
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class Products(HardcodedStream):
|
|
25
|
+
sample_record = {
|
|
26
|
+
"id": 1,
|
|
27
|
+
"make": "Mazda",
|
|
28
|
+
"model": "MX-5",
|
|
29
|
+
"year": 2008,
|
|
30
|
+
"price": 2869,
|
|
31
|
+
"created_at": "2022-02-01T17:02:19+00:00",
|
|
32
|
+
"updated_at": "2022-11-01T17:02:19+00:00",
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class Customers(HardcodedStream):
|
|
37
|
+
sample_record = {
|
|
38
|
+
"id": 6569096478909,
|
|
39
|
+
"email": "test@test.com",
|
|
40
|
+
"created_at": "2023-04-13T02:30:04-07:00",
|
|
41
|
+
"updated_at": "2023-04-24T06:53:48-07:00",
|
|
42
|
+
"first_name": "New Test",
|
|
43
|
+
"last_name": "Customer",
|
|
44
|
+
"orders_count": 0,
|
|
45
|
+
"state": "disabled",
|
|
46
|
+
"total_spent": 0.0,
|
|
47
|
+
"last_order_id": None,
|
|
48
|
+
"note": "updated_mon_24.04.2023",
|
|
49
|
+
"verified_email": True,
|
|
50
|
+
"multipass_identifier": None,
|
|
51
|
+
"tax_exempt": False,
|
|
52
|
+
"tags": "",
|
|
53
|
+
"last_order_name": None,
|
|
54
|
+
"currency": "USD",
|
|
55
|
+
"phone": "+380639379992",
|
|
56
|
+
"addresses": [
|
|
57
|
+
{
|
|
58
|
+
"id": 8092523135165,
|
|
59
|
+
"customer_id": 6569096478909,
|
|
60
|
+
"first_name": "New Test",
|
|
61
|
+
"last_name": "Customer",
|
|
62
|
+
"company": "Test Company",
|
|
63
|
+
"address1": "My Best Accent",
|
|
64
|
+
"address2": "",
|
|
65
|
+
"city": "Fair Lawn",
|
|
66
|
+
"province": "New Jersey",
|
|
67
|
+
"country": "United States",
|
|
68
|
+
"zip": "07410",
|
|
69
|
+
"phone": "",
|
|
70
|
+
"name": "New Test Customer",
|
|
71
|
+
"province_code": "NJ",
|
|
72
|
+
"country_code": "US",
|
|
73
|
+
"country_name": "United States",
|
|
74
|
+
"default": True,
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"accepts_marketing": True,
|
|
78
|
+
"accepts_marketing_updated_at": "2023-04-13T02:30:04-07:00",
|
|
79
|
+
"marketing_opt_in_level": "single_opt_in",
|
|
80
|
+
"tax_exemptions": "[]",
|
|
81
|
+
"email_marketing_consent": {
|
|
82
|
+
"state": "subscribed",
|
|
83
|
+
"opt_in_level": "single_opt_in",
|
|
84
|
+
"consent_updated_at": "2023-04-13T02:30:04-07:00",
|
|
85
|
+
},
|
|
86
|
+
"sms_marketing_consent": {
|
|
87
|
+
"state": "not_subscribed",
|
|
88
|
+
"opt_in_level": "single_opt_in",
|
|
89
|
+
"consent_updated_at": None,
|
|
90
|
+
"consent_collected_from": "SHOPIFY",
|
|
91
|
+
},
|
|
92
|
+
"admin_graphql_api_id": "gid://shopify/Customer/6569096478909",
|
|
93
|
+
"default_address": {
|
|
94
|
+
"id": 8092523135165,
|
|
95
|
+
"customer_id": 6569096478909,
|
|
96
|
+
"first_name": "New Test",
|
|
97
|
+
"last_name": "Customer",
|
|
98
|
+
"company": "Test Company",
|
|
99
|
+
"address1": "My Best Accent",
|
|
100
|
+
"address2": "",
|
|
101
|
+
"city": "Fair Lawn",
|
|
102
|
+
"province": "New Jersey",
|
|
103
|
+
"country": "United States",
|
|
104
|
+
"zip": "07410",
|
|
105
|
+
"phone": "",
|
|
106
|
+
"name": "New Test Customer",
|
|
107
|
+
"province_code": "NJ",
|
|
108
|
+
"country_code": "US",
|
|
109
|
+
"country_name": "United States",
|
|
110
|
+
"default": True,
|
|
111
|
+
},
|
|
112
|
+
"shop_url": "airbyte-integration-test",
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class DummyFields(HardcodedStream):
|
|
117
|
+
sample_record = {
|
|
118
|
+
"field1": "valuevaluevaluevaluevalue1",
|
|
119
|
+
"field2": "valuevaluevaluevaluevalue1",
|
|
120
|
+
"field3": "valuevaluevaluevaluevalue1",
|
|
121
|
+
"field4": "valuevaluevaluevaluevalue1",
|
|
122
|
+
"field5": "valuevaluevaluevaluevalue1",
|
|
123
|
+
}
|