airbyte-source-microsoft-dataverse 0.1.2__tar.gz → 0.1.4__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.
Files changed (31) hide show
  1. airbyte_source_microsoft_dataverse-0.1.4/PKG-INFO +110 -0
  2. airbyte_source_microsoft_dataverse-0.1.4/README.md +91 -0
  3. airbyte_source_microsoft_dataverse-0.1.4/pyproject.toml +33 -0
  4. airbyte-source-microsoft-dataverse-0.1.2/PKG-INFO +0 -99
  5. airbyte-source-microsoft-dataverse-0.1.2/README.md +0 -100
  6. airbyte-source-microsoft-dataverse-0.1.2/airbyte_source_microsoft_dataverse.egg-info/PKG-INFO +0 -99
  7. airbyte-source-microsoft-dataverse-0.1.2/airbyte_source_microsoft_dataverse.egg-info/SOURCES.txt +0 -27
  8. airbyte-source-microsoft-dataverse-0.1.2/airbyte_source_microsoft_dataverse.egg-info/dependency_links.txt +0 -1
  9. airbyte-source-microsoft-dataverse-0.1.2/airbyte_source_microsoft_dataverse.egg-info/entry_points.txt +0 -2
  10. airbyte-source-microsoft-dataverse-0.1.2/airbyte_source_microsoft_dataverse.egg-info/requires.txt +0 -6
  11. airbyte-source-microsoft-dataverse-0.1.2/airbyte_source_microsoft_dataverse.egg-info/top_level.txt +0 -3
  12. airbyte-source-microsoft-dataverse-0.1.2/integration_tests/__init__.py +0 -3
  13. airbyte-source-microsoft-dataverse-0.1.2/integration_tests/abnormal_state.json +0 -5
  14. airbyte-source-microsoft-dataverse-0.1.2/integration_tests/acceptance.py +0 -16
  15. airbyte-source-microsoft-dataverse-0.1.2/integration_tests/configured_catalog.json +0 -15
  16. airbyte-source-microsoft-dataverse-0.1.2/integration_tests/invalid_config.json +0 -7
  17. airbyte-source-microsoft-dataverse-0.1.2/integration_tests/sample_config.json +0 -7
  18. airbyte-source-microsoft-dataverse-0.1.2/integration_tests/sample_state.json +0 -5
  19. airbyte-source-microsoft-dataverse-0.1.2/setup.cfg +0 -97
  20. airbyte-source-microsoft-dataverse-0.1.2/setup.py +0 -43
  21. airbyte-source-microsoft-dataverse-0.1.2/unit_tests/__init__.py +0 -3
  22. airbyte-source-microsoft-dataverse-0.1.2/unit_tests/test_dataverse.py +0 -15
  23. airbyte-source-microsoft-dataverse-0.1.2/unit_tests/test_incremental_streams.py +0 -101
  24. airbyte-source-microsoft-dataverse-0.1.2/unit_tests/test_source.py +0 -148
  25. airbyte-source-microsoft-dataverse-0.1.2/unit_tests/test_streams.py +0 -107
  26. {airbyte-source-microsoft-dataverse-0.1.2 → airbyte_source_microsoft_dataverse-0.1.4}/source_microsoft_dataverse/__init__.py +0 -0
  27. {airbyte-source-microsoft-dataverse-0.1.2 → airbyte_source_microsoft_dataverse-0.1.4}/source_microsoft_dataverse/dataverse.py +0 -0
  28. {airbyte-source-microsoft-dataverse-0.1.2 → airbyte_source_microsoft_dataverse-0.1.4}/source_microsoft_dataverse/run.py +0 -0
  29. {airbyte-source-microsoft-dataverse-0.1.2 → airbyte_source_microsoft_dataverse-0.1.4}/source_microsoft_dataverse/source.py +0 -0
  30. {airbyte-source-microsoft-dataverse-0.1.2 → airbyte_source_microsoft_dataverse-0.1.4}/source_microsoft_dataverse/spec.yaml +0 -0
  31. {airbyte-source-microsoft-dataverse-0.1.2 → airbyte_source_microsoft_dataverse-0.1.4}/source_microsoft_dataverse/streams.py +0 -0
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.1
2
+ Name: airbyte-source-microsoft-dataverse
3
+ Version: 0.1.4
4
+ Summary: Source implementation for Microsoft Dataverse.
5
+ Home-page: https://airbyte.com
6
+ License: MIT
7
+ Author: Airbyte
8
+ Author-email: contact@airbyte.io
9
+ Requires-Python: >=3.9,<3.12
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
+ Requires-Dist: airbyte-cdk (==0.80.0)
16
+ Project-URL: Documentation, https://docs.airbyte.com/integrations/sources/microsoft-dataverse
17
+ Project-URL: Repository, https://github.com/airbytehq/airbyte
18
+ Description-Content-Type: text/markdown
19
+
20
+ # Microsoft-Dataverse source connector
21
+
22
+
23
+ This is the repository for the Microsoft-Dataverse 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/microsoft-dataverse).
25
+
26
+ ## Local development
27
+
28
+ ### Prerequisites
29
+ * Python (~=3.9)
30
+ * Poetry (~=1.7) - installation instructions [here](https://python-poetry.org/docs/#installation)
31
+
32
+
33
+ ### Installing the connector
34
+ From this connector directory, run:
35
+ ```bash
36
+ poetry install --with dev
37
+ ```
38
+
39
+
40
+ ### Create credentials
41
+ **If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.com/integrations/sources/microsoft-dataverse)
42
+ to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_microsoft_dataverse/spec.yaml` file.
43
+ Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
44
+ See `sample_files/sample_config.json` for a sample config file.
45
+
46
+
47
+ ### Locally running the connector
48
+ ```
49
+ poetry run source-microsoft-dataverse spec
50
+ poetry run source-microsoft-dataverse check --config secrets/config.json
51
+ poetry run source-microsoft-dataverse discover --config secrets/config.json
52
+ poetry run source-microsoft-dataverse read --config secrets/config.json --catalog sample_files/configured_catalog.json
53
+ ```
54
+
55
+ ### Running unit tests
56
+ To run unit tests locally, from the connector directory run:
57
+ ```
58
+ poetry run pytest unit_tests
59
+ ```
60
+
61
+ ### Building the docker image
62
+ 1. Install [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md)
63
+ 2. Run the following command to build the docker image:
64
+ ```bash
65
+ airbyte-ci connectors --name=source-microsoft-dataverse build
66
+ ```
67
+
68
+ An image will be available on your host with the tag `airbyte/source-microsoft-dataverse:dev`.
69
+
70
+
71
+ ### Running as a docker container
72
+ Then run any of the connector commands as follows:
73
+ ```
74
+ docker run --rm airbyte/source-microsoft-dataverse:dev spec
75
+ docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-microsoft-dataverse:dev check --config /secrets/config.json
76
+ docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-microsoft-dataverse:dev discover --config /secrets/config.json
77
+ docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-microsoft-dataverse:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
78
+ ```
79
+
80
+ ### Running our CI test suite
81
+ You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
82
+ ```bash
83
+ airbyte-ci connectors --name=source-microsoft-dataverse test
84
+ ```
85
+
86
+ ### Customizing acceptance Tests
87
+ 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.
88
+ 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.
89
+
90
+ ### Dependency Management
91
+ All of your dependencies should be managed via Poetry.
92
+ To add a new dependency, run:
93
+ ```bash
94
+ poetry add <package-name>
95
+ ```
96
+
97
+ Please commit the changes to `pyproject.toml` and `poetry.lock` files.
98
+
99
+ ## Publishing a new version of the connector
100
+ You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
101
+ 1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-microsoft-dataverse test`
102
+ 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)):
103
+ - bump the `dockerImageTag` value in in `metadata.yaml`
104
+ - bump the `version` value in `pyproject.toml`
105
+ 3. Make sure the `metadata.yaml` content is up to date.
106
+ 4. Make sure the connector documentation and its changelog is up to date (`docs/integrations/sources/microsoft-dataverse.md`).
107
+ 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).
108
+ 6. Pat yourself on the back for being an awesome contributor.
109
+ 7. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.
110
+ 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,91 @@
1
+ # Microsoft-Dataverse source connector
2
+
3
+
4
+ This is the repository for the Microsoft-Dataverse source connector, written in Python.
5
+ For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.com/integrations/sources/microsoft-dataverse).
6
+
7
+ ## Local development
8
+
9
+ ### Prerequisites
10
+ * Python (~=3.9)
11
+ * Poetry (~=1.7) - installation instructions [here](https://python-poetry.org/docs/#installation)
12
+
13
+
14
+ ### Installing the connector
15
+ From this connector directory, run:
16
+ ```bash
17
+ poetry install --with dev
18
+ ```
19
+
20
+
21
+ ### Create credentials
22
+ **If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.com/integrations/sources/microsoft-dataverse)
23
+ to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_microsoft_dataverse/spec.yaml` file.
24
+ Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
25
+ See `sample_files/sample_config.json` for a sample config file.
26
+
27
+
28
+ ### Locally running the connector
29
+ ```
30
+ poetry run source-microsoft-dataverse spec
31
+ poetry run source-microsoft-dataverse check --config secrets/config.json
32
+ poetry run source-microsoft-dataverse discover --config secrets/config.json
33
+ poetry run source-microsoft-dataverse read --config secrets/config.json --catalog sample_files/configured_catalog.json
34
+ ```
35
+
36
+ ### Running unit tests
37
+ To run unit tests locally, from the connector directory run:
38
+ ```
39
+ poetry run pytest unit_tests
40
+ ```
41
+
42
+ ### Building the docker image
43
+ 1. Install [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md)
44
+ 2. Run the following command to build the docker image:
45
+ ```bash
46
+ airbyte-ci connectors --name=source-microsoft-dataverse build
47
+ ```
48
+
49
+ An image will be available on your host with the tag `airbyte/source-microsoft-dataverse:dev`.
50
+
51
+
52
+ ### Running as a docker container
53
+ Then run any of the connector commands as follows:
54
+ ```
55
+ docker run --rm airbyte/source-microsoft-dataverse:dev spec
56
+ docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-microsoft-dataverse:dev check --config /secrets/config.json
57
+ docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-microsoft-dataverse:dev discover --config /secrets/config.json
58
+ docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-microsoft-dataverse:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
59
+ ```
60
+
61
+ ### Running our CI test suite
62
+ You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
63
+ ```bash
64
+ airbyte-ci connectors --name=source-microsoft-dataverse test
65
+ ```
66
+
67
+ ### Customizing acceptance Tests
68
+ 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.
69
+ 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.
70
+
71
+ ### Dependency Management
72
+ All of your dependencies should be managed via Poetry.
73
+ To add a new dependency, run:
74
+ ```bash
75
+ poetry add <package-name>
76
+ ```
77
+
78
+ Please commit the changes to `pyproject.toml` and `poetry.lock` files.
79
+
80
+ ## Publishing a new version of the connector
81
+ You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
82
+ 1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-microsoft-dataverse test`
83
+ 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)):
84
+ - bump the `dockerImageTag` value in in `metadata.yaml`
85
+ - bump the `version` value in `pyproject.toml`
86
+ 3. Make sure the `metadata.yaml` content is up to date.
87
+ 4. Make sure the connector documentation and its changelog is up to date (`docs/integrations/sources/microsoft-dataverse.md`).
88
+ 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).
89
+ 6. Pat yourself on the back for being an awesome contributor.
90
+ 7. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.
91
+ 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,33 @@
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.1.4"
9
+ name = "airbyte-source-microsoft-dataverse"
10
+ description = "Source implementation for Microsoft Dataverse."
11
+ authors = [
12
+ "Airbyte <contact@airbyte.io>",
13
+ ]
14
+ license = "MIT"
15
+ readme = "README.md"
16
+ documentation = "https://docs.airbyte.com/integrations/sources/microsoft-dataverse"
17
+ homepage = "https://airbyte.com"
18
+ repository = "https://github.com/airbytehq/airbyte"
19
+ packages = [
20
+ { include = "source_microsoft_dataverse" },
21
+ ]
22
+
23
+ [tool.poetry.dependencies]
24
+ python = "^3.9,<3.12"
25
+ airbyte-cdk = "0.80.0"
26
+
27
+ [tool.poetry.scripts]
28
+ source-microsoft-dataverse = "source_microsoft_dataverse.run:run"
29
+
30
+ [tool.poetry.group.dev.dependencies]
31
+ requests-mock = "^1.9.3"
32
+ pytest = "^6.1"
33
+ pytest-mock = "^3.6.1"
@@ -1,99 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: airbyte-source-microsoft-dataverse
3
- Version: 0.1.2
4
- Summary: Source implementation for Microsoft Dataverse.
5
- Author: Airbyte
6
- Author-email: contact@airbyte.io
7
- Description-Content-Type: text/markdown
8
- Requires-Dist: airbyte-cdk~=0.2
9
- Provides-Extra: tests
10
- Requires-Dist: requests-mock~=1.9.3; extra == "tests"
11
- Requires-Dist: pytest~=6.1; extra == "tests"
12
- Requires-Dist: pytest-mock~=3.6.1; extra == "tests"
13
-
14
- # Microsoft Dataverse Source
15
-
16
- This is the repository for the Microsoft Dataverse source connector, written in Python.
17
- For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/microsoft-dataverse).
18
-
19
-
20
- **To iterate on this connector, make sure to complete this prerequisites section.**
21
-
22
-
23
- From this connector directory, create a virtual environment:
24
- ```
25
- python -m venv .venv
26
- ```
27
-
28
- This will generate a virtualenv for this module in `.venv/`. Make sure this venv is active in your
29
- development environment of choice. To activate it from the terminal, run:
30
- ```
31
- source .venv/bin/activate
32
- pip install -r requirements.txt
33
- pip install '.[tests]'
34
- ```
35
- If you are in an IDE, follow your IDE's instructions to activate the virtualenv.
36
-
37
- Note that while we are installing dependencies from `requirements.txt`, you should only edit `setup.py` for your dependencies. `requirements.txt` is
38
- used for editable installs (`pip install -e`) to pull in Python dependencies from the monorepo and will call `setup.py`.
39
- If this is mumbo jumbo to you, don't worry about it, just put your deps in `setup.py` but install using `pip install -r requirements.txt` and everything
40
- should work as you expect.
41
-
42
- **If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/microsoft-dataverse)
43
- to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_microsoft_dataverse/spec.yaml` file.
44
- Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
45
- See `integration_tests/sample_config.json` for a sample config file.
46
-
47
- **If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source microsoft-dataverse test creds`
48
- and place them into `secrets/config.json`.
49
-
50
- ```
51
- python main.py spec
52
- python main.py check --config secrets/config.json
53
- python main.py discover --config secrets/config.json
54
- python main.py read --config secrets/config.json --catalog integration_tests/configured_catalog.json
55
- ```
56
-
57
-
58
-
59
- **Via [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md) (recommended):**
60
- ```bash
61
- airbyte-ci connectors --name=source-microsoft-dataverse build
62
- ```
63
-
64
- An image will be built with the tag `airbyte/source-microsoft-dataverse:dev`.
65
-
66
- **Via `docker build`:**
67
- ```bash
68
- docker build -t airbyte/source-microsoft-dataverse:dev .
69
- ```
70
-
71
- Then run any of the connector commands as follows:
72
- ```
73
- docker run --rm airbyte/source-microsoft-dataverse:dev spec
74
- docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-microsoft-dataverse:dev check --config /secrets/config.json
75
- docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-microsoft-dataverse:dev discover --config /secrets/config.json
76
- docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-microsoft-dataverse:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
77
- ```
78
-
79
- You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
80
- ```bash
81
- airbyte-ci connectors --name=source-microsoft-dataverse test
82
- ```
83
-
84
- Customize `acceptance-test-config.yml` file to configure tests. See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference) for more information.
85
- 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.
86
-
87
- All of your dependencies should go in `setup.py`, NOT `requirements.txt`. The requirements file is only used to connect internal Airbyte dependencies in the monorepo for local development.
88
- We split dependencies between two groups, dependencies that are:
89
- * required for your connector to work need to go to `MAIN_REQUIREMENTS` list.
90
- * required for the testing need to go to `TEST_REQUIREMENTS` list
91
-
92
- You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
93
- 1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-microsoft-dataverse test`
94
- 2. Bump the connector version in `metadata.yaml`: increment the `dockerImageTag` value. Please follow [semantic versioning for connectors](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#semantic-versioning-for-connectors).
95
- 3. Make sure the `metadata.yaml` content is up to date.
96
- 4. Make the connector documentation and its changelog is up to date (`docs/integrations/sources/microsoft-dataverse.md`).
97
- 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).
98
- 6. Pat yourself on the back for being an awesome contributor.
99
- 7. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.
@@ -1,100 +0,0 @@
1
- # Microsoft Dataverse Source
2
-
3
- This is the repository for the Microsoft Dataverse source connector, written in Python.
4
- For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/microsoft-dataverse).
5
-
6
- ## Local development
7
-
8
- ### Prerequisites
9
- **To iterate on this connector, make sure to complete this prerequisites section.**
10
-
11
- #### Minimum Python version required `= 3.9.0`
12
-
13
- #### Build & Activate Virtual Environment and install dependencies
14
- From this connector directory, create a virtual environment:
15
- ```
16
- python -m venv .venv
17
- ```
18
-
19
- This will generate a virtualenv for this module in `.venv/`. Make sure this venv is active in your
20
- development environment of choice. To activate it from the terminal, run:
21
- ```
22
- source .venv/bin/activate
23
- pip install -r requirements.txt
24
- pip install '.[tests]'
25
- ```
26
- If you are in an IDE, follow your IDE's instructions to activate the virtualenv.
27
-
28
- Note that while we are installing dependencies from `requirements.txt`, you should only edit `setup.py` for your dependencies. `requirements.txt` is
29
- used for editable installs (`pip install -e`) to pull in Python dependencies from the monorepo and will call `setup.py`.
30
- If this is mumbo jumbo to you, don't worry about it, just put your deps in `setup.py` but install using `pip install -r requirements.txt` and everything
31
- should work as you expect.
32
-
33
- #### Create credentials
34
- **If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/microsoft-dataverse)
35
- to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_microsoft_dataverse/spec.yaml` file.
36
- Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
37
- See `integration_tests/sample_config.json` for a sample config file.
38
-
39
- **If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source microsoft-dataverse test creds`
40
- and place them into `secrets/config.json`.
41
-
42
- ### Locally running the connector
43
- ```
44
- python main.py spec
45
- python main.py check --config secrets/config.json
46
- python main.py discover --config secrets/config.json
47
- python main.py read --config secrets/config.json --catalog integration_tests/configured_catalog.json
48
- ```
49
-
50
- ### Locally running the connector docker image
51
-
52
-
53
- #### Build
54
- **Via [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md) (recommended):**
55
- ```bash
56
- airbyte-ci connectors --name=source-microsoft-dataverse build
57
- ```
58
-
59
- An image will be built with the tag `airbyte/source-microsoft-dataverse:dev`.
60
-
61
- **Via `docker build`:**
62
- ```bash
63
- docker build -t airbyte/source-microsoft-dataverse:dev .
64
- ```
65
-
66
- #### Run
67
- Then run any of the connector commands as follows:
68
- ```
69
- docker run --rm airbyte/source-microsoft-dataverse:dev spec
70
- docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-microsoft-dataverse:dev check --config /secrets/config.json
71
- docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-microsoft-dataverse:dev discover --config /secrets/config.json
72
- docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-microsoft-dataverse:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
73
- ```
74
-
75
- ## Testing
76
- You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
77
- ```bash
78
- airbyte-ci connectors --name=source-microsoft-dataverse test
79
- ```
80
-
81
- ### Customizing acceptance Tests
82
- Customize `acceptance-test-config.yml` file to configure tests. See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference) for more information.
83
- 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.
84
-
85
- ## Dependency Management
86
- All of your dependencies should go in `setup.py`, NOT `requirements.txt`. The requirements file is only used to connect internal Airbyte dependencies in the monorepo for local development.
87
- We split dependencies between two groups, dependencies that are:
88
- * required for your connector to work need to go to `MAIN_REQUIREMENTS` list.
89
- * required for the testing need to go to `TEST_REQUIREMENTS` list
90
-
91
- ### Publishing a new version of the connector
92
- You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
93
- 1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-microsoft-dataverse test`
94
- 2. Bump the connector version in `metadata.yaml`: increment the `dockerImageTag` value. Please follow [semantic versioning for connectors](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#semantic-versioning-for-connectors).
95
- 3. Make sure the `metadata.yaml` content is up to date.
96
- 4. Make the connector documentation and its changelog is up to date (`docs/integrations/sources/microsoft-dataverse.md`).
97
- 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).
98
- 6. Pat yourself on the back for being an awesome contributor.
99
- 7. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.
100
-
@@ -1,99 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: airbyte-source-microsoft-dataverse
3
- Version: 0.1.2
4
- Summary: Source implementation for Microsoft Dataverse.
5
- Author: Airbyte
6
- Author-email: contact@airbyte.io
7
- Description-Content-Type: text/markdown
8
- Requires-Dist: airbyte-cdk~=0.2
9
- Provides-Extra: tests
10
- Requires-Dist: requests-mock~=1.9.3; extra == "tests"
11
- Requires-Dist: pytest~=6.1; extra == "tests"
12
- Requires-Dist: pytest-mock~=3.6.1; extra == "tests"
13
-
14
- # Microsoft Dataverse Source
15
-
16
- This is the repository for the Microsoft Dataverse source connector, written in Python.
17
- For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/microsoft-dataverse).
18
-
19
-
20
- **To iterate on this connector, make sure to complete this prerequisites section.**
21
-
22
-
23
- From this connector directory, create a virtual environment:
24
- ```
25
- python -m venv .venv
26
- ```
27
-
28
- This will generate a virtualenv for this module in `.venv/`. Make sure this venv is active in your
29
- development environment of choice. To activate it from the terminal, run:
30
- ```
31
- source .venv/bin/activate
32
- pip install -r requirements.txt
33
- pip install '.[tests]'
34
- ```
35
- If you are in an IDE, follow your IDE's instructions to activate the virtualenv.
36
-
37
- Note that while we are installing dependencies from `requirements.txt`, you should only edit `setup.py` for your dependencies. `requirements.txt` is
38
- used for editable installs (`pip install -e`) to pull in Python dependencies from the monorepo and will call `setup.py`.
39
- If this is mumbo jumbo to you, don't worry about it, just put your deps in `setup.py` but install using `pip install -r requirements.txt` and everything
40
- should work as you expect.
41
-
42
- **If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/microsoft-dataverse)
43
- to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_microsoft_dataverse/spec.yaml` file.
44
- Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
45
- See `integration_tests/sample_config.json` for a sample config file.
46
-
47
- **If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source microsoft-dataverse test creds`
48
- and place them into `secrets/config.json`.
49
-
50
- ```
51
- python main.py spec
52
- python main.py check --config secrets/config.json
53
- python main.py discover --config secrets/config.json
54
- python main.py read --config secrets/config.json --catalog integration_tests/configured_catalog.json
55
- ```
56
-
57
-
58
-
59
- **Via [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md) (recommended):**
60
- ```bash
61
- airbyte-ci connectors --name=source-microsoft-dataverse build
62
- ```
63
-
64
- An image will be built with the tag `airbyte/source-microsoft-dataverse:dev`.
65
-
66
- **Via `docker build`:**
67
- ```bash
68
- docker build -t airbyte/source-microsoft-dataverse:dev .
69
- ```
70
-
71
- Then run any of the connector commands as follows:
72
- ```
73
- docker run --rm airbyte/source-microsoft-dataverse:dev spec
74
- docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-microsoft-dataverse:dev check --config /secrets/config.json
75
- docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-microsoft-dataverse:dev discover --config /secrets/config.json
76
- docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-microsoft-dataverse:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
77
- ```
78
-
79
- You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
80
- ```bash
81
- airbyte-ci connectors --name=source-microsoft-dataverse test
82
- ```
83
-
84
- Customize `acceptance-test-config.yml` file to configure tests. See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference) for more information.
85
- 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.
86
-
87
- All of your dependencies should go in `setup.py`, NOT `requirements.txt`. The requirements file is only used to connect internal Airbyte dependencies in the monorepo for local development.
88
- We split dependencies between two groups, dependencies that are:
89
- * required for your connector to work need to go to `MAIN_REQUIREMENTS` list.
90
- * required for the testing need to go to `TEST_REQUIREMENTS` list
91
-
92
- You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
93
- 1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-microsoft-dataverse test`
94
- 2. Bump the connector version in `metadata.yaml`: increment the `dockerImageTag` value. Please follow [semantic versioning for connectors](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#semantic-versioning-for-connectors).
95
- 3. Make sure the `metadata.yaml` content is up to date.
96
- 4. Make the connector documentation and its changelog is up to date (`docs/integrations/sources/microsoft-dataverse.md`).
97
- 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).
98
- 6. Pat yourself on the back for being an awesome contributor.
99
- 7. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.
@@ -1,27 +0,0 @@
1
- README.md
2
- setup.cfg
3
- setup.py
4
- airbyte_source_microsoft_dataverse.egg-info/PKG-INFO
5
- airbyte_source_microsoft_dataverse.egg-info/SOURCES.txt
6
- airbyte_source_microsoft_dataverse.egg-info/dependency_links.txt
7
- airbyte_source_microsoft_dataverse.egg-info/entry_points.txt
8
- airbyte_source_microsoft_dataverse.egg-info/requires.txt
9
- airbyte_source_microsoft_dataverse.egg-info/top_level.txt
10
- integration_tests/__init__.py
11
- integration_tests/abnormal_state.json
12
- integration_tests/acceptance.py
13
- integration_tests/configured_catalog.json
14
- integration_tests/invalid_config.json
15
- integration_tests/sample_config.json
16
- integration_tests/sample_state.json
17
- source_microsoft_dataverse/__init__.py
18
- source_microsoft_dataverse/dataverse.py
19
- source_microsoft_dataverse/run.py
20
- source_microsoft_dataverse/source.py
21
- source_microsoft_dataverse/spec.yaml
22
- source_microsoft_dataverse/streams.py
23
- unit_tests/__init__.py
24
- unit_tests/test_dataverse.py
25
- unit_tests/test_incremental_streams.py
26
- unit_tests/test_source.py
27
- unit_tests/test_streams.py
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- source-microsoft-dataverse = source_microsoft_dataverse.run:run
@@ -1,6 +0,0 @@
1
- airbyte-cdk~=0.2
2
-
3
- [tests]
4
- requests-mock~=1.9.3
5
- pytest~=6.1
6
- pytest-mock~=3.6.1
@@ -1,3 +0,0 @@
1
- integration_tests
2
- source_microsoft_dataverse
3
- unit_tests
@@ -1,3 +0,0 @@
1
- #
2
- # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3
- #
@@ -1,5 +0,0 @@
1
- {
2
- "<entity_name>": {
3
- "$deltatoken": "12644418993!10/06/2050 20:06:12"
4
- }
5
- }
@@ -1,16 +0,0 @@
1
- #
2
- # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3
- #
4
-
5
-
6
- import pytest
7
-
8
- pytest_plugins = ("connector_acceptance_test.plugin",)
9
-
10
-
11
- @pytest.fixture(scope="session", autouse=True)
12
- def connector_setup():
13
- """This fixture is a placeholder for external resources that acceptance test might require."""
14
- # TODO: setup test dependencies if needed. otherwise remove the TODO comments
15
- yield
16
- # TODO: clean up test dependencies
@@ -1,15 +0,0 @@
1
- {
2
- "streams": [
3
- {
4
- "stream": {
5
- "name": "<entity_name>",
6
- "json_schema": {},
7
- "supported_sync_modes": ["full_refresh", "incremental"]
8
- },
9
- "cursor_field": ["modifiedon"],
10
- "primary_key": [["<entity_primary_key>"]],
11
- "sync_mode": "incremental",
12
- "destination_sync_mode": "append"
13
- }
14
- ]
15
- }
@@ -1,7 +0,0 @@
1
- {
2
- "client_id": "<client_id>",
3
- "tenant_id": "<tenant_id>",
4
- "client_secret_value": "<invalid_client_secret>",
5
- "url": "<url>",
6
- "odata.maxpagesize": 100
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "url": "<url>",
3
- "client_id": "<client_id>",
4
- "tenant_id": "<tenant_id>",
5
- "client_secret_value": "<client_secret>",
6
- "odata_maxpagesize": 5000
7
- }
@@ -1,5 +0,0 @@
1
- {
2
- "<entity_name>": {
3
- "$deltatoken": "12644418993!10/06/2022 20:06:12"
4
- }
5
- }
@@ -1,97 +0,0 @@
1
- [metadata]
2
- name = airbyte-source-microsoft-dataverse
3
- version = 0.1.2
4
- author = Airbyte
5
- author_email = contact@airbyte.io
6
- long_description = # Microsoft Dataverse Source
7
-
8
- This is the repository for the Microsoft Dataverse source connector, written in Python.
9
- For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/microsoft-dataverse).
10
-
11
-
12
- **To iterate on this connector, make sure to complete this prerequisites section.**
13
-
14
-
15
- From this connector directory, create a virtual environment:
16
- ```
17
- python -m venv .venv
18
- ```
19
-
20
- This will generate a virtualenv for this module in `.venv/`. Make sure this venv is active in your
21
- development environment of choice. To activate it from the terminal, run:
22
- ```
23
- source .venv/bin/activate
24
- pip install -r requirements.txt
25
- pip install '.[tests]'
26
- ```
27
- If you are in an IDE, follow your IDE's instructions to activate the virtualenv.
28
-
29
- Note that while we are installing dependencies from `requirements.txt`, you should only edit `setup.py` for your dependencies. `requirements.txt` is
30
- used for editable installs (`pip install -e`) to pull in Python dependencies from the monorepo and will call `setup.py`.
31
- If this is mumbo jumbo to you, don't worry about it, just put your deps in `setup.py` but install using `pip install -r requirements.txt` and everything
32
- should work as you expect.
33
-
34
- **If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/microsoft-dataverse)
35
- to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_microsoft_dataverse/spec.yaml` file.
36
- Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
37
- See `integration_tests/sample_config.json` for a sample config file.
38
-
39
- **If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source microsoft-dataverse test creds`
40
- and place them into `secrets/config.json`.
41
-
42
- ```
43
- python main.py spec
44
- python main.py check --config secrets/config.json
45
- python main.py discover --config secrets/config.json
46
- python main.py read --config secrets/config.json --catalog integration_tests/configured_catalog.json
47
- ```
48
-
49
-
50
-
51
- **Via [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md) (recommended):**
52
- ```bash
53
- airbyte-ci connectors --name=source-microsoft-dataverse build
54
- ```
55
-
56
- An image will be built with the tag `airbyte/source-microsoft-dataverse:dev`.
57
-
58
- **Via `docker build`:**
59
- ```bash
60
- docker build -t airbyte/source-microsoft-dataverse:dev .
61
- ```
62
-
63
- Then run any of the connector commands as follows:
64
- ```
65
- docker run --rm airbyte/source-microsoft-dataverse:dev spec
66
- docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-microsoft-dataverse:dev check --config /secrets/config.json
67
- docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-microsoft-dataverse:dev discover --config /secrets/config.json
68
- docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-microsoft-dataverse:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
69
- ```
70
-
71
- You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
72
- ```bash
73
- airbyte-ci connectors --name=source-microsoft-dataverse test
74
- ```
75
-
76
- Customize `acceptance-test-config.yml` file to configure tests. See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference) for more information.
77
- 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.
78
-
79
- All of your dependencies should go in `setup.py`, NOT `requirements.txt`. The requirements file is only used to connect internal Airbyte dependencies in the monorepo for local development.
80
- We split dependencies between two groups, dependencies that are:
81
- * required for your connector to work need to go to `MAIN_REQUIREMENTS` list.
82
- * required for the testing need to go to `TEST_REQUIREMENTS` list
83
-
84
- You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
85
- 1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-microsoft-dataverse test`
86
- 2. Bump the connector version in `metadata.yaml`: increment the `dockerImageTag` value. Please follow [semantic versioning for connectors](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#semantic-versioning-for-connectors).
87
- 3. Make sure the `metadata.yaml` content is up to date.
88
- 4. Make the connector documentation and its changelog is up to date (`docs/integrations/sources/microsoft-dataverse.md`).
89
- 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).
90
- 6. Pat yourself on the back for being an awesome contributor.
91
- 7. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.
92
- long_description_content_type = text/markdown
93
-
94
- [egg_info]
95
- tag_build =
96
- tag_date = 0
97
-
@@ -1,43 +0,0 @@
1
- #
2
- # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3
- #
4
-
5
-
6
- from setuptools import find_packages, setup
7
-
8
- MAIN_REQUIREMENTS = [
9
- "airbyte-cdk~=0.2",
10
- ]
11
-
12
- TEST_REQUIREMENTS = [
13
- "requests-mock~=1.9.3",
14
- "pytest~=6.1",
15
- "pytest-mock~=3.6.1",
16
- ]
17
-
18
- setup(
19
- entry_points={
20
- "console_scripts": [
21
- "source-microsoft-dataverse=source_microsoft_dataverse.run:run",
22
- ],
23
- },
24
- description="Source implementation for Microsoft Dataverse.",
25
- packages=find_packages(),
26
- install_requires=MAIN_REQUIREMENTS,
27
- package_data={
28
- "": [
29
- # Include yaml files in the package (if any)
30
- "*.yml",
31
- "*.yaml",
32
- # Include all json files in the package, up to 4 levels deep
33
- "*.json",
34
- "*/*.json",
35
- "*/*/*.json",
36
- "*/*/*/*.json",
37
- "*/*/*/*/*.json",
38
- ]
39
- },
40
- extras_require={
41
- "tests": TEST_REQUIREMENTS,
42
- },
43
- )
@@ -1,3 +0,0 @@
1
- #
2
- # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3
- #
@@ -1,15 +0,0 @@
1
- #
2
- # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3
- #
4
-
5
- import pytest
6
- from source_microsoft_dataverse.dataverse import AirbyteType, convert_dataverse_type
7
-
8
-
9
- @pytest.mark.parametrize(
10
- "dataverse_type,expected_result",
11
- [("String", AirbyteType.String.value), ("Integer", AirbyteType.Integer.value), ("Virtual", None), ("Random", AirbyteType.String.value)],
12
- )
13
- def test_convert_dataverse_type(dataverse_type, expected_result):
14
- result = convert_dataverse_type(dataverse_type)
15
- assert result == expected_result
@@ -1,101 +0,0 @@
1
- #
2
- # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3
- #
4
-
5
- from unittest.mock import MagicMock
6
-
7
- from pytest import fixture
8
- from source_microsoft_dataverse.source import IncrementalMicrosoftDataverseStream
9
-
10
-
11
- @fixture
12
- def incremental_config():
13
- return {
14
- "url": "http://test-url",
15
- "stream_name": "test_stream",
16
- "stream_path": "test_path",
17
- "primary_key": [["test_primary_key"]],
18
- "schema": {},
19
- "odata_maxpagesize": 100,
20
- "config_cursor_field": ["test_cursor_field"],
21
- "authenticator": MagicMock(),
22
- }
23
-
24
-
25
- @fixture
26
- def incremental_response(incremental_config):
27
- return {
28
- "@odata.deltaLink": f"{incremental_config['url']}?$deltatoken=12644418993%2110%2F06%2F2022%2020%3A06%3A12",
29
- "value": [
30
- {"test_primary_key": "pk", "test_cursor_field": "test-date"},
31
- {"id": "pk2", "@odata.context": "context", "reason": "deleted"},
32
- ],
33
- }
34
-
35
-
36
- def test_primary_key(incremental_config):
37
- stream = IncrementalMicrosoftDataverseStream(**incremental_config)
38
- expected_primary_key = [["test_primary_key"]]
39
- assert stream.primary_key == expected_primary_key
40
-
41
-
42
- def test_stream_name(incremental_config):
43
- stream = IncrementalMicrosoftDataverseStream(**incremental_config)
44
- expected_stream_name = "test_stream"
45
- assert stream.name == expected_stream_name
46
-
47
-
48
- def test_stream_path(incremental_config):
49
- stream = IncrementalMicrosoftDataverseStream(**incremental_config)
50
- expected_stream_path = "test_path"
51
- assert stream.path() == expected_stream_path
52
-
53
-
54
- def test_cursor_field(incremental_config):
55
- stream = IncrementalMicrosoftDataverseStream(**incremental_config)
56
- expected_cursor_field = ["test_cursor_field"]
57
- assert stream.cursor_field == expected_cursor_field
58
-
59
-
60
- def test_supports_incremental(incremental_config, mocker):
61
- mocker.patch.object(IncrementalMicrosoftDataverseStream, "cursor_field", "dummy_field")
62
- stream = IncrementalMicrosoftDataverseStream(**incremental_config)
63
- assert stream.supports_incremental
64
-
65
-
66
- def test_source_defined_cursor(incremental_config):
67
- stream = IncrementalMicrosoftDataverseStream(**incremental_config)
68
- assert stream.source_defined_cursor
69
-
70
-
71
- def test_stream_checkpoint_interval(incremental_config):
72
- stream = IncrementalMicrosoftDataverseStream(**incremental_config)
73
- expected_checkpoint_interval = None
74
- assert stream.state_checkpoint_interval == expected_checkpoint_interval
75
-
76
-
77
- def test_parse_request(incremental_config, incremental_response, mocker):
78
- response_mock, datetime_mock = MagicMock(), MagicMock()
79
- response_mock.json.return_value = incremental_response
80
- datetime_mock.now.return_value.isoformat.return_value = "test-time"
81
- mocker.patch("source_microsoft_dataverse.streams.datetime", datetime_mock)
82
-
83
- stream = IncrementalMicrosoftDataverseStream(**incremental_config)
84
-
85
- iterable = stream.parse_response(response_mock)
86
- iterable_list = list(iterable)
87
- assert len(iterable_list) == 2
88
- assert stream.state[stream.delta_token_field] == "12644418993!10/06/2022 20:06:12"
89
- assert iterable_list[0]["_ab_cdc_updated_at"] == "test-date"
90
- assert iterable_list[1]["_ab_cdc_deleted_at"] == "test-time"
91
- assert iterable_list[1][incremental_config["primary_key"][0][0]] == "pk2"
92
- assert "id" not in iterable_list[1]
93
- assert "reason" not in iterable_list[1]
94
- assert "@odata.context" not in iterable_list[1]
95
-
96
-
97
- def test_request_headers(incremental_config):
98
- stream = IncrementalMicrosoftDataverseStream(**incremental_config)
99
- headers = stream.request_headers(stream_state={})
100
- assert "Prefer" in headers
101
- assert headers["Prefer"] == "odata.track-changes,odata.maxpagesize=100"
@@ -1,148 +0,0 @@
1
- #
2
- # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3
- #
4
-
5
- import json
6
- from unittest import mock
7
- from unittest.mock import MagicMock
8
-
9
- from airbyte_cdk.models import SyncMode
10
- from source_microsoft_dataverse.dataverse import AirbyteType
11
- from source_microsoft_dataverse.source import SourceMicrosoftDataverse
12
- from source_microsoft_dataverse.streams import IncrementalMicrosoftDataverseStream, MicrosoftDataverseStream
13
-
14
-
15
- @mock.patch("source_microsoft_dataverse.source.do_request")
16
- def test_check_connection(mock_request):
17
- mock_request.return_value.raise_for_status = lambda: ()
18
- source = SourceMicrosoftDataverse()
19
- logger_mock, config_mock = MagicMock(), MagicMock()
20
- assert source.check_connection(logger_mock, config_mock) == (True, None)
21
-
22
-
23
- @mock.patch("source_microsoft_dataverse.source.get_auth")
24
- @mock.patch("source_microsoft_dataverse.source.do_request")
25
- def test_streams_incremental(mock_get_auth, mock_request):
26
- streams = MagicMock()
27
- streams.sync_mode = SyncMode.incremental
28
- streams.stream.name = "test"
29
-
30
- catalog = MagicMock()
31
-
32
- catalog.streams = [streams]
33
-
34
- config_mock = MagicMock()
35
- source = SourceMicrosoftDataverse()
36
- source.catalogs = catalog
37
-
38
- streams = source.streams(config_mock)
39
-
40
- expected_streams_number = 1
41
- assert len(streams) == expected_streams_number
42
- assert isinstance(streams[0], IncrementalMicrosoftDataverseStream)
43
- assert streams[0].name == "test"
44
-
45
-
46
- @mock.patch("source_microsoft_dataverse.source.get_auth")
47
- @mock.patch("source_microsoft_dataverse.source.do_request")
48
- def test_streams_full_refresh(mock_get_auth, mock_request):
49
- streams = MagicMock()
50
- streams.sync_mode = SyncMode.full_refresh
51
- streams.stream.name = "test"
52
-
53
- catalog = MagicMock()
54
-
55
- catalog.streams = [streams]
56
-
57
- config_mock = MagicMock()
58
- source = SourceMicrosoftDataverse()
59
- source.catalogs = catalog
60
-
61
- streams = source.streams(config_mock)
62
-
63
- expected_streams_number = 1
64
- assert len(streams) == expected_streams_number
65
- assert isinstance(streams[0], MicrosoftDataverseStream)
66
- assert streams[0].name == "test"
67
-
68
-
69
- @mock.patch("source_microsoft_dataverse.source.do_request")
70
- def test_discover_incremental(mock_request):
71
- result_json = json.loads(
72
- """
73
- {
74
- "value": [
75
- {
76
- "LogicalName": "stream",
77
- "PrimaryIdAttribute": "primary",
78
- "ChangeTrackingEnabled": true,
79
- "CanChangeTrackingBeEnabled": {
80
- "Value": true
81
- },
82
- "Attributes": [
83
- {
84
- "LogicalName": "test",
85
- "AttributeType": "String"
86
- },
87
- {
88
- "LogicalName": "modifiedon",
89
- "AttributeType": "DateTime"
90
- }
91
- ]
92
- }
93
- ]
94
- }
95
- """
96
- )
97
-
98
- mock_request.return_value.status.return_value = 200
99
- mock_request.return_value.json.return_value = result_json
100
-
101
- source = SourceMicrosoftDataverse()
102
- logger_mock, config_mock = MagicMock(), MagicMock()
103
-
104
- catalog = source.discover(logger_mock, config_mock)
105
-
106
- assert not {"modifiedon"} ^ set(catalog.streams[0].default_cursor_field)
107
- assert not {SyncMode.full_refresh, SyncMode.incremental} ^ set(catalog.streams[0].supported_sync_modes)
108
- assert not {"primary"} ^ set(catalog.streams[0].source_defined_primary_key[0])
109
- assert catalog.streams[0].json_schema["properties"]["test"] == AirbyteType.String.value
110
-
111
-
112
- @mock.patch("source_microsoft_dataverse.source.do_request")
113
- def test_discover_full_refresh(mock_request):
114
- result_json = json.loads(
115
- """
116
- {
117
- "value": [
118
- {
119
- "LogicalName": "stream",
120
- "PrimaryIdAttribute": "primary",
121
- "ChangeTrackingEnabled": false,
122
- "CanChangeTrackingBeEnabled": {
123
- "Value": false
124
- },
125
- "Attributes": [
126
- {
127
- "LogicalName": "test",
128
- "AttributeType": "String"
129
- }
130
- ]
131
- }
132
- ]
133
- }
134
- """
135
- )
136
-
137
- mock_request.return_value.status.return_value = 200
138
- mock_request.return_value.json.return_value = result_json
139
-
140
- source = SourceMicrosoftDataverse()
141
- logger_mock, config_mock = MagicMock(), MagicMock()
142
-
143
- catalog = source.discover(logger_mock, config_mock)
144
-
145
- assert catalog.streams[0].default_cursor_field is None or len(catalog.streams[0].default_cursor_field) == 0
146
- assert not {SyncMode.full_refresh} ^ set(catalog.streams[0].supported_sync_modes)
147
- assert not {"primary"} ^ set(catalog.streams[0].source_defined_primary_key[0])
148
- assert catalog.streams[0].json_schema["properties"]["test"] == AirbyteType.String.value
@@ -1,107 +0,0 @@
1
- #
2
- # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3
- #
4
-
5
- from http import HTTPStatus
6
- from unittest.mock import MagicMock
7
-
8
- import pytest
9
- from pytest import fixture
10
- from source_microsoft_dataverse.source import MicrosoftDataverseStream
11
-
12
-
13
- @fixture
14
- def incremental_config():
15
- return {
16
- "url": "http://test-url",
17
- "stream_name": "test_stream",
18
- "stream_path": "test_path",
19
- "primary_key": [["test_primary_key"]],
20
- "schema": {},
21
- "odata_maxpagesize": 100,
22
- "authenticator": MagicMock(),
23
- }
24
-
25
-
26
- @pytest.mark.parametrize(
27
- ("inputs", "expected_params"),
28
- [
29
- ({"stream_slice": None, "stream_state": {}, "next_page_token": None}, {}),
30
- ({"stream_slice": None, "stream_state": {}, "next_page_token": {"$skiptoken": "skiptoken"}}, {"$skiptoken": "skiptoken"}),
31
- ({"stream_slice": None, "stream_state": {"$deltatoken": "delta"}, "next_page_token": None}, {"$deltatoken": "delta"}),
32
- ],
33
- )
34
- def test_request_params(inputs, expected_params, incremental_config):
35
- stream = MicrosoftDataverseStream(**incremental_config)
36
- assert stream.request_params(**inputs) == expected_params
37
-
38
-
39
- @pytest.mark.parametrize(
40
- ("response_json", "next_page_token"),
41
- [
42
- (
43
- {
44
- "@odata.nextLink": "https://url?$skiptoken=oEBwdSP6uehIAxQOWq_3Ksh_TLol6KIm3stvdc6hGhZRi1hQ7Spe__dpvm3U4zReE4CYXC2zOtaKdi7KHlUtC2CbRiBIUwOxPKLa"
45
- },
46
- {"$skiptoken": "oEBwdSP6uehIAxQOWq_3Ksh_TLol6KIm3stvdc6hGhZRi1hQ7Spe__dpvm3U4zReE4CYXC2zOtaKdi7KHlUtC2CbRiBIUwOxPKLa"},
47
- ),
48
- ({"value": []}, None),
49
- ],
50
- )
51
- def test_next_page_token(response_json, next_page_token, incremental_config):
52
- stream = MicrosoftDataverseStream(**incremental_config)
53
- response = MagicMock()
54
- response.json.return_value = response_json
55
- inputs = {"response": response}
56
- expected_token = next_page_token
57
- assert stream.next_page_token(**inputs) == expected_token
58
-
59
-
60
- def test_parse_response(incremental_config):
61
- stream = MicrosoftDataverseStream(**incremental_config)
62
- response = MagicMock()
63
- response.json.return_value = {"value": [{"test-key": "test-value"}]}
64
- inputs = {"response": response}
65
- expected_parsed_object = {"test-key": "test-value"}
66
- assert next(stream.parse_response(**inputs)) == expected_parsed_object
67
-
68
-
69
- def test_request_headers(incremental_config):
70
- stream = MicrosoftDataverseStream(**incremental_config)
71
- inputs = {"stream_slice": None, "stream_state": None, "next_page_token": None}
72
- expected_headers = {
73
- "Cache-Control": "no-cache",
74
- "OData-Version": "4.0",
75
- "Content-Type": "application/json",
76
- "Prefer": "odata.maxpagesize=100",
77
- }
78
- assert stream.request_headers(**inputs) == expected_headers
79
-
80
-
81
- def test_http_method(incremental_config):
82
- stream = MicrosoftDataverseStream(**incremental_config)
83
- expected_method = "GET"
84
- assert stream.http_method == expected_method
85
-
86
-
87
- @pytest.mark.parametrize(
88
- ("http_status", "should_retry"),
89
- [
90
- (HTTPStatus.OK, False),
91
- (HTTPStatus.BAD_REQUEST, False),
92
- (HTTPStatus.TOO_MANY_REQUESTS, True),
93
- (HTTPStatus.INTERNAL_SERVER_ERROR, True),
94
- ],
95
- )
96
- def test_should_retry(incremental_config, http_status, should_retry):
97
- response_mock = MagicMock()
98
- response_mock.status_code = http_status
99
- stream = MicrosoftDataverseStream(**incremental_config)
100
- assert stream.should_retry(response_mock) == should_retry
101
-
102
-
103
- def test_backoff_time(incremental_config):
104
- response_mock = MagicMock()
105
- stream = MicrosoftDataverseStream(**incremental_config)
106
- expected_backoff_time = None
107
- assert stream.backoff_time(response_mock) == expected_backoff_time