-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨Source Shortio: Migrate Python CDK to Low-code CDK (#28950)
* Migrate Shortio to Low-Code * Update abnormal state * Format * Update Docs * Fix metadata.yaml * Add pagination * Add incremental sync * add incremental parameters * update metadata * rollback update version * release date --------- Co-authored-by: marcosmarxm <marcosmarxm@gmail.com>
- Loading branch information
Showing
24 changed files
with
299 additions
and
421 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,38 @@ | ||
FROM python:3.9-slim | ||
FROM python:3.9.11-alpine3.15 as base | ||
|
||
# build and load all requirements | ||
FROM base as builder | ||
WORKDIR /airbyte/integration_code | ||
|
||
# upgrade pip to the latest version | ||
RUN apk --no-cache upgrade \ | ||
&& pip install --upgrade pip \ | ||
&& apk --no-cache add tzdata build-base | ||
|
||
# Bash is installed for more convenient debugging. | ||
RUN apt-get update && apt-get install -y bash && rm -rf /var/lib/apt/lists/* | ||
|
||
COPY setup.py ./ | ||
# install necessary packages to a temporary folder | ||
RUN pip install --prefix=/install . | ||
|
||
# build a clean environment | ||
FROM base | ||
WORKDIR /airbyte/integration_code | ||
COPY source_shortio ./source_shortio | ||
|
||
# copy all loaded and built libraries to a pure basic image | ||
COPY --from=builder /install /usr/local | ||
# add default timezone settings | ||
COPY --from=builder /usr/share/zoneinfo/Etc/UTC /etc/localtime | ||
RUN echo "Etc/UTC" > /etc/timezone | ||
|
||
# bash is installed for more convenient debugging. | ||
RUN apk --no-cache add bash | ||
|
||
# copy payload code only | ||
COPY main.py ./ | ||
COPY setup.py ./ | ||
RUN pip install . | ||
COPY source_shortio ./source_shortio | ||
|
||
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py" | ||
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"] | ||
|
||
LABEL io.airbyte.version=0.1.3 | ||
LABEL io.airbyte.version=0.2.0 | ||
LABEL io.airbyte.name=airbyte/source-shortio |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# | ||
# Copyright (c) 2023 Airbyte, Inc., all rights reserved. | ||
# |
48 changes: 31 additions & 17 deletions
48
airbyte-integrations/connectors/source-shortio/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 |
---|---|---|
@@ -1,25 +1,39 @@ | ||
# See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference) | ||
# for more information about how to configure these tests | ||
connector_image: airbyte/source-shortio:dev | ||
tests: | ||
acceptance_tests: | ||
spec: | ||
- spec_path: "source_shortio/spec.json" | ||
tests: | ||
- spec_path: "source_shortio/spec.yaml" | ||
connection: | ||
- config_path: "secrets/config.json" | ||
status: "succeed" | ||
- config_path: "integration_tests/invalid_config.json" | ||
status: "failed" | ||
tests: | ||
- config_path: "secrets/config.json" | ||
status: "succeed" | ||
- config_path: "integration_tests/invalid_config.json" | ||
status: "failed" | ||
discovery: | ||
- config_path: "secrets/config.json" | ||
tests: | ||
- config_path: "secrets/config.json" | ||
basic_read: | ||
- config_path: "secrets/config.json" | ||
configured_catalog_path: "integration_tests/configured_catalog.json" | ||
empty_streams: ["clicks"] | ||
# TODO: uncomment when any of incremental streams has records | ||
# incremental: | ||
# - config_path: "secrets/config.json" | ||
# configured_catalog_path: "integration_tests/configured_catalog.json" | ||
# future_state_path: "integration_tests/abnormal_state.json" | ||
tests: | ||
- config_path: "secrets/config.json" | ||
configured_catalog_path: "integration_tests/configured_catalog.json" | ||
empty_streams: | ||
- name: clicks | ||
bypass_reason: "Sandbox account cannot seed the stream" | ||
expect_records: | ||
path: "integration_tests/expected_records.jsonl" | ||
extra_fields: no | ||
exact_order: no | ||
extra_records: yes | ||
incremental: | ||
# bypass_reason: "This connector does not implement incremental sync" | ||
tests: | ||
- config_path: "secrets/config.json" | ||
configured_catalog_path: "integration_tests/configured_catalog.json" | ||
future_state: | ||
future_state_path: "integration_tests/abnormal_state.json" | ||
full_refresh: | ||
- config_path: "secrets/config.json" | ||
configured_catalog_path: "integration_tests/configured_catalog.json" | ||
tests: | ||
- config_path: "secrets/config.json" | ||
configured_catalog_path: "integration_tests/configured_catalog.json" |
1 change: 1 addition & 0 deletions
1
airbyte-integrations/connectors/source-shortio/acceptance-test-docker.sh
100644 → 100755
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,2 +1,3 @@ | ||
#!/usr/bin/env sh | ||
|
||
source "$(git rev-parse --show-toplevel)/airbyte-integrations/bases/connector-acceptance-test/acceptance-test-docker.sh" |
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,3 @@ | ||
# | ||
# Copyright (c) 2023 Airbyte, Inc., all rights reserved. | ||
# |
19 changes: 15 additions & 4 deletions
19
airbyte-integrations/connectors/source-shortio/integration_tests/abnormal_state.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 |
---|---|---|
@@ -1,5 +1,16 @@ | ||
{ | ||
"clicks": { | ||
"dt": "2052-07-17 14:03:43.449925" | ||
[ | ||
{ | ||
"type": "STREAM", | ||
"stream": { | ||
"stream_state": { "updatedAt": "2099-07-31T03:43:59.244Z" }, | ||
"stream_descriptor": { "name": "links" } | ||
} | ||
}, | ||
{ | ||
"type": "STREAM", | ||
"stream": { | ||
"stream_state": { "dt": "2099-09-10T12:44:55.000Z" }, | ||
"stream_descriptor": { "name": "clicks" } | ||
} | ||
} | ||
} | ||
] |
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
17 changes: 8 additions & 9 deletions
17
airbyte-integrations/connectors/source-shortio/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 |
---|---|---|
@@ -1,25 +1,24 @@ | ||
{ | ||
"streams": [ | ||
{ | ||
"destination_sync_mode": "append", | ||
"sync_mode": "incremental", | ||
"stream": { | ||
"name": "clicks", | ||
"source_defined_cursor": true, | ||
"default_cursor_field": ["dt"], | ||
"supported_sync_modes": ["incremental"], | ||
"json_schema": {} | ||
} | ||
}, | ||
"destination_sync_mode": "append", | ||
"sync_mode": "incremental" | ||
}, | ||
{ | ||
"destination_sync_mode": "append", | ||
"sync_mode": "full_refresh", | ||
"stream": { | ||
"name": "links", | ||
"source_defined_cursor": true, | ||
"supported_sync_modes": ["full_refresh"], | ||
"json_schema": {} | ||
} | ||
"json_schema": {}, | ||
"supported_sync_modes": ["full_refresh", "incremental"] | ||
}, | ||
"sync_mode": "incremental", | ||
"destination_sync_mode": "append" | ||
} | ||
] | ||
} |
4 changes: 4 additions & 0 deletions
4
airbyte-integrations/connectors/source-shortio/integration_tests/expected_records.jsonl
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,4 @@ | ||
{"stream": "links", "data": {"lcpath": "gem9bt", "createdAt": "2021-08-09T13:51:46.000Z", "source": "spreadsheets", "DomainId": 235589, "archived": false, "updatedAt": "2021-08-09T13:51:46.000Z", "OwnerId": 231775, "originalURL": "https://jk-genesis.com.ua/promotions/kvartiry-rjadom-s-metro-shuljavskaja-ot-980-00-grn?utm_source=lun.ua&utm_medium=referral&utm_content=239563406.1628516963&utm_term=5105", "cloaking": false, "path": "geM9Bt", "idString": "lnk_ZhP_Tw4Ye", "shortURL": "https://1hsf.short.gy/geM9Bt", "secureShortURL": "https://1hsf.short.gy/geM9Bt", "id": "lnk_ZhP_Tw4Ye", "User": {"id": 231775, "name": "Jean Lafleur", "email": "integration-test@airbyte.io", "photoURL": null}}, "emitted_at": 1691072031178} | ||
{"stream": "links", "data": {"lcpath": "4sfi0i", "createdAt": "2021-08-09T13:51:46.000Z", "source": "spreadsheets", "DomainId": 235589, "archived": false, "updatedAt": "2021-08-09T13:51:46.000Z", "OwnerId": 231775, "originalURL": "https://airbyte.io/connector-development-kit", "cloaking": false, "path": "4SfI0I", "idString": "lnk_ZhP_Tw4Y3", "shortURL": "https://1hsf.short.gy/4SfI0I", "secureShortURL": "https://1hsf.short.gy/4SfI0I", "id": "lnk_ZhP_Tw4Y3", "User": {"id": 231775, "name": "Jean Lafleur", "email": "integration-test@airbyte.io", "photoURL": null}}, "emitted_at": 1691072031183} | ||
{"stream": "links", "data": {"lcpath": "saeipy", "createdAt": "2021-08-09T13:51:46.000Z", "source": "spreadsheets", "DomainId": 235589, "archived": false, "updatedAt": "2021-08-09T13:51:46.000Z", "OwnerId": 231775, "originalURL": "https://great.com.ua/ua/news/11/znizhki-do-10-u-zhitlovomu-kompleksi-great/?utm_source=lun.ua&utm_medium=referral&utm_content=239563406.1628516963&utm_term=6405", "cloaking": false, "path": "Saeipy", "idString": "lnk_ZhP_Tw4Y9", "shortURL": "https://1hsf.short.gy/Saeipy", "secureShortURL": "https://1hsf.short.gy/Saeipy", "id": "lnk_ZhP_Tw4Y9", "User": {"id": 231775, "name": "Jean Lafleur", "email": "integration-test@airbyte.io", "photoURL": null}}, "emitted_at": 1691072031187} | ||
{"stream": "links", "data": {"lcpath": "48ne6k", "createdAt": "2021-08-09T13:51:46.000Z", "source": "spreadsheets", "DomainId": 235589, "archived": false, "updatedAt": "2021-08-09T13:51:46.000Z", "OwnerId": 231775, "originalURL": "http://www.redstar.ru/2005/03/10_03/1_02.html", "cloaking": false, "path": "48ne6k", "idString": "lnk_ZhP_Tw4Y4", "shortURL": "https://1hsf.short.gy/48ne6k", "secureShortURL": "https://1hsf.short.gy/48ne6k", "id": "lnk_ZhP_Tw4Y4", "User": {"id": 231775, "name": "Jean Lafleur", "email": "integration-test@airbyte.io", "photoURL": null}}, "emitted_at": 1691072031191} |
4 changes: 2 additions & 2 deletions
4
airbyte-integrations/connectors/source-shortio/integration_tests/invalid_config.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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"secret_key": "RANDOMKEY", | ||
"domain_id": "123456", | ||
"start_date": "2021-07-01" | ||
"domain_id": "99999999", | ||
"start_date": "2099-07-01" | ||
} |
5 changes: 5 additions & 0 deletions
5
airbyte-integrations/connectors/source-shortio/integration_tests/sample_config.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,5 @@ | ||
{ | ||
"secret_key": "KEY", | ||
"domain_id": "123456", | ||
"start_date": "2023-07-30T03:43:59.244Z" | ||
} |
File renamed without changes.
27 changes: 14 additions & 13 deletions
27
airbyte-integrations/connectors/source-shortio/metadata.yaml
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,24 +1,25 @@ | ||
data: | ||
allowedHosts: | ||
hosts: | ||
- https://api.short.io | ||
- https://api-v2.short.cm | ||
registries: | ||
oss: | ||
enabled: true | ||
cloud: | ||
enabled: true | ||
connectorSubtype: api | ||
connectorType: source | ||
definitionId: 2fed2292-5586-480c-af92-9944e39fe12d | ||
dockerImageTag: 0.1.3 | ||
dockerImageTag: 0.2.0 | ||
dockerRepository: airbyte/source-shortio | ||
githubIssueLabel: source-shortio | ||
icon: short.svg | ||
icon: shortio.svg | ||
license: MIT | ||
name: Short.io | ||
registries: | ||
cloud: | ||
enabled: true | ||
oss: | ||
enabled: true | ||
name: Shortio | ||
releaseDate: 2023-08-02 | ||
releaseStage: alpha | ||
documentationUrl: https://docs.airbyte.com/integrations/sources/shortio | ||
tags: | ||
- language:python | ||
_ab_internal: | ||
_sl: 100 | ||
_ql: 200 | ||
supportLevel: community | ||
- language:lowcode | ||
metadataSpecVersion: "1.0" |
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
22 changes: 1 addition & 21 deletions
22
airbyte-integrations/connectors/source-shortio/source_shortio/__init__.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
Oops, something went wrong.