-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎉 Instagram Source: Migrate to use CDK, upgrade API version and fix f…
…ailures with HTTP status 400 (#4210) * handling 400 HTTP error with Backoff * migrate to CDK Co-authored-by: ykurochkin <y.kurochkin@zazmic.com> Co-authored-by: Eugene Kulak <kulak.eugene@gmail.com>
- Loading branch information
1 parent
4774edf
commit c8b8b52
Showing
28 changed files
with
1,079 additions
and
1,063 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
* | ||
!Dockerfile | ||
!Dockerfile.test | ||
!main.py | ||
!source_instagram | ||
!setup.py | ||
!secrets |
16 changes: 7 additions & 9 deletions
16
airbyte-integrations/connectors/source-instagram/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,16 @@ | ||
FROM airbyte/integration-base-python:0.1.1 | ||
FROM python:3.7-slim | ||
|
||
# Bash is installed for more convenient debugging. | ||
RUN apt-get update && apt-get install -y bash && rm -rf /var/lib/apt/lists/* | ||
|
||
ENV CODE_PATH="source_instagram" | ||
ENV AIRBYTE_IMPL_MODULE="source_instagram" | ||
ENV AIRBYTE_IMPL_PATH="SourceInstagram" | ||
|
||
WORKDIR /airbyte/integration_code | ||
COPY $CODE_PATH ./$CODE_PATH | ||
COPY source_instagram ./source_instagram | ||
COPY main.py ./ | ||
COPY setup.py ./ | ||
RUN pip install ".[main]" | ||
RUN pip install . | ||
|
||
ENV AIRBYTE_ENTRYPOINT "/airbyte/base.sh" | ||
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py" | ||
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"] | ||
|
||
LABEL io.airbyte.version=0.1.5 | ||
LABEL io.airbyte.version=0.1.6 | ||
LABEL io.airbyte.name=airbyte/source-instagram |
25 changes: 25 additions & 0 deletions
25
airbyte-integrations/connectors/source-instagram/acceptance-test-config.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# See [Source Acceptance Tests](https://docs.airbyte.io/contributing-to-airbyte/building-new-connector/source-acceptance-tests.md) | ||
# for more information about how to configure these tests | ||
connector_image: airbyte/source-instagram:dev | ||
tests: | ||
spec: | ||
- spec_path: "integration_tests/spec.json" | ||
connection: | ||
- config_path: "secrets/config.json" | ||
status: "succeed" | ||
- config_path: "integration_tests/invalid_config.json" | ||
status: "failed" | ||
discovery: | ||
- config_path: "secrets/config.json" | ||
basic_read: | ||
- config_path: "secrets/config.json" | ||
configured_catalog_path: "integration_tests/configured_catalog_without_stories.json" | ||
validate_output_from_all_streams: yes | ||
# disabled because the only incremental stream is user_insights and its state is nested | ||
# incremental: | ||
# - config_path: "secrets/config.json" | ||
# configured_catalog_path: "integration_tests/configured_catalog.json" | ||
# future_state_path: "integration_tests/abnormal_state.json" | ||
full_refresh: | ||
- config_path: "secrets/config.json" | ||
configured_catalog_path: "integration_tests/configured_catalog.json" |
18 changes: 2 additions & 16 deletions
18
airbyte-integrations/connectors/source-instagram/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,13 @@ | ||
plugins { | ||
id 'airbyte-python' | ||
id 'airbyte-docker' | ||
id 'airbyte-standard-source-test-file' | ||
id 'airbyte-source-acceptance-test' | ||
} | ||
|
||
airbytePython { | ||
moduleDirectory 'source_instagram' | ||
} | ||
|
||
airbyteStandardSourceTestFile { | ||
specPath = "source_instagram/spec.json" | ||
configPath = "secrets/config.json" | ||
configuredCatalogPath = "sample_files/configured_catalog.json" | ||
} | ||
|
||
task("pythonIntegrationTests", type: PythonTask, dependsOn: installTestReqs) { | ||
module = "pytest" | ||
command = "-s integration_tests" | ||
} | ||
|
||
integrationTest.dependsOn("pythonIntegrationTests") | ||
|
||
dependencies { | ||
implementation files(project(':airbyte-integrations:bases:base-standard-source-test-file').airbyteDocker.outputs) | ||
implementation files(project(':airbyte-integrations:bases:base-python').airbyteDocker.outputs) | ||
implementation files(project(':airbyte-integrations:bases:source-acceptance-test').airbyteDocker.outputs) | ||
} |
Empty file.
34 changes: 34 additions & 0 deletions
34
airbyte-integrations/connectors/source-instagram/integration_tests/acceptance.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# MIT License | ||
# | ||
# Copyright (c) 2020 Airbyte | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
# | ||
|
||
|
||
import pytest | ||
|
||
pytest_plugins = ("source_acceptance_test.plugin",) | ||
|
||
|
||
@pytest.fixture(scope="session", autouse=True) | ||
def connector_setup(): | ||
"""This fixture is a placeholder for external resources that acceptance test might require.""" | ||
yield |
109 changes: 109 additions & 0 deletions
109
airbyte-integrations/connectors/source-instagram/integration_tests/configured_catalog.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
{ | ||
"streams": [ | ||
{ | ||
"stream": { | ||
"name": "media", | ||
"json_schema": {}, | ||
"supported_sync_modes": ["full_refresh"], | ||
"source_defined_cursor": null, | ||
"default_cursor_field": null, | ||
"source_defined_primary_key": [["id"]], | ||
"namespace": null | ||
}, | ||
"sync_mode": "full_refresh", | ||
"cursor_field": null, | ||
"destination_sync_mode": "append", | ||
"primary_key": null | ||
}, | ||
{ | ||
"stream": { | ||
"name": "media_insights", | ||
"json_schema": {}, | ||
"supported_sync_modes": ["full_refresh"], | ||
"source_defined_cursor": null, | ||
"default_cursor_field": null, | ||
"source_defined_primary_key": [["id"]], | ||
"namespace": null | ||
}, | ||
"sync_mode": "full_refresh", | ||
"cursor_field": null, | ||
"destination_sync_mode": "append", | ||
"primary_key": null | ||
}, | ||
{ | ||
"stream": { | ||
"name": "stories", | ||
"json_schema": {}, | ||
"supported_sync_modes": ["full_refresh"], | ||
"source_defined_cursor": null, | ||
"default_cursor_field": null, | ||
"source_defined_primary_key": [["id"]], | ||
"namespace": null | ||
}, | ||
"sync_mode": "full_refresh", | ||
"cursor_field": null, | ||
"destination_sync_mode": "append", | ||
"primary_key": null | ||
}, | ||
{ | ||
"stream": { | ||
"name": "story_insights", | ||
"json_schema": {}, | ||
"supported_sync_modes": ["full_refresh"], | ||
"source_defined_cursor": null, | ||
"default_cursor_field": null, | ||
"source_defined_primary_key": [["id"]], | ||
"namespace": null | ||
}, | ||
"sync_mode": "full_refresh", | ||
"cursor_field": null, | ||
"destination_sync_mode": "append", | ||
"primary_key": null | ||
}, | ||
{ | ||
"stream": { | ||
"name": "users", | ||
"json_schema": {}, | ||
"supported_sync_modes": ["full_refresh"], | ||
"source_defined_cursor": null, | ||
"default_cursor_field": null, | ||
"source_defined_primary_key": [["id"]], | ||
"namespace": null | ||
}, | ||
"sync_mode": "full_refresh", | ||
"cursor_field": null, | ||
"destination_sync_mode": "append", | ||
"primary_key": null | ||
}, | ||
{ | ||
"stream": { | ||
"name": "user_lifetime_insights", | ||
"json_schema": {}, | ||
"supported_sync_modes": ["full_refresh"], | ||
"source_defined_cursor": null, | ||
"default_cursor_field": null, | ||
"source_defined_primary_key": null, | ||
"namespace": null | ||
}, | ||
"sync_mode": "full_refresh", | ||
"cursor_field": null, | ||
"destination_sync_mode": "append", | ||
"primary_key": null | ||
}, | ||
{ | ||
"stream": { | ||
"name": "user_insights", | ||
"json_schema": {}, | ||
"supported_sync_modes": ["full_refresh", "incremental"], | ||
"source_defined_cursor": true, | ||
"default_cursor_field": ["date"], | ||
"source_defined_primary_key": null, | ||
"namespace": null | ||
}, | ||
"sync_mode": "incremental", | ||
"cursor_field": null, | ||
"destination_sync_mode": "append", | ||
"primary_key": null | ||
} | ||
] | ||
} |
79 changes: 79 additions & 0 deletions
79
...ons/connectors/source-instagram/integration_tests/configured_catalog_without_stories.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
{ | ||
"streams": [ | ||
{ | ||
"stream": { | ||
"name": "media", | ||
"json_schema": {}, | ||
"supported_sync_modes": ["full_refresh"], | ||
"source_defined_cursor": null, | ||
"default_cursor_field": null, | ||
"source_defined_primary_key": [["id"]], | ||
"namespace": null | ||
}, | ||
"sync_mode": "full_refresh", | ||
"cursor_field": null, | ||
"destination_sync_mode": "append", | ||
"primary_key": null | ||
}, | ||
{ | ||
"stream": { | ||
"name": "media_insights", | ||
"json_schema": {}, | ||
"supported_sync_modes": ["full_refresh"], | ||
"source_defined_cursor": null, | ||
"default_cursor_field": null, | ||
"source_defined_primary_key": [["id"]], | ||
"namespace": null | ||
}, | ||
"sync_mode": "full_refresh", | ||
"cursor_field": null, | ||
"destination_sync_mode": "append", | ||
"primary_key": null | ||
}, | ||
{ | ||
"stream": { | ||
"name": "users", | ||
"json_schema": {}, | ||
"supported_sync_modes": ["full_refresh"], | ||
"source_defined_cursor": null, | ||
"default_cursor_field": null, | ||
"source_defined_primary_key": [["id"]], | ||
"namespace": null | ||
}, | ||
"sync_mode": "full_refresh", | ||
"cursor_field": null, | ||
"destination_sync_mode": "append", | ||
"primary_key": null | ||
}, | ||
{ | ||
"stream": { | ||
"name": "user_lifetime_insights", | ||
"json_schema": {}, | ||
"supported_sync_modes": ["full_refresh"], | ||
"source_defined_cursor": null, | ||
"default_cursor_field": null, | ||
"source_defined_primary_key": null, | ||
"namespace": null | ||
}, | ||
"sync_mode": "full_refresh", | ||
"cursor_field": null, | ||
"destination_sync_mode": "append", | ||
"primary_key": null | ||
}, | ||
{ | ||
"stream": { | ||
"name": "user_insights", | ||
"json_schema": {}, | ||
"supported_sync_modes": ["full_refresh", "incremental"], | ||
"source_defined_cursor": true, | ||
"default_cursor_field": ["date"], | ||
"source_defined_primary_key": null, | ||
"namespace": null | ||
}, | ||
"sync_mode": "full_refresh", | ||
"cursor_field": null, | ||
"destination_sync_mode": "append", | ||
"primary_key": null | ||
} | ||
] | ||
} |
40 changes: 40 additions & 0 deletions
40
airbyte-integrations/connectors/source-instagram/integration_tests/conftest.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# | ||
# MIT License | ||
# | ||
# Copyright (c) 2020 Airbyte | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
# | ||
|
||
|
||
import json | ||
|
||
import pytest | ||
from airbyte_cdk.models import ConfiguredAirbyteCatalog | ||
|
||
|
||
@pytest.fixture(scope="session", name="config") | ||
def config_fixture(): | ||
with open("secrets/config.json", "r") as config_file: | ||
return json.load(config_file) | ||
|
||
|
||
@pytest.fixture(scope="session", name="configured_catalog") | ||
def configured_catalog_fixture(): | ||
return ConfiguredAirbyteCatalog.parse_file("integration_tests/configured_catalog.json") |
Oops, something went wrong.