Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

source-twilio: implement lookback windows #13896

Merged
merged 54 commits into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
7b104a5
set lookback
Lex-MUTTDATA May 2, 2022
9ab1abb
lookback in minutes
Lex-MUTTDATA May 4, 2022
2c851f4
delete comments
Lex-MUTTDATA May 4, 2022
9c66dae
add IncrementalMixin function
Lex-MUTTDATA May 13, 2022
ab26add
lookback description
Lex-MUTTDATA May 13, 2022
0852e61
modify lookback __init__
Lex-MUTTDATA May 13, 2022
449eaf2
pagesize parameter
Lex-MUTTDATA May 13, 2022
fd62791
chore(twilio-connector): changelog and bump version
gvillafanetapia May 19, 2022
fea98cb
fixed dates format
Lex-MUTTDATA May 27, 2022
a34e61b
delete comments lines and prints
Lex-MUTTDATA May 27, 2022
7c304ec
Merge branch 'master' into refactor/source-twilio-muttdata
Lex-MUTTDATA May 27, 2022
7519a71
Update streams.py
Lex-MUTTDATA May 27, 2022
4dd0f30
delete line 79
Lex-MUTTDATA May 30, 2022
6e95ae2
Update lookback spec to integer
Lex-MUTTDATA Jun 3, 2022
ef1bfe9
Update lookback spec name
Lex-MUTTDATA Jun 3, 2022
eecdfce
Update page_size spec
Lex-MUTTDATA Jun 3, 2022
d84bd06
Update page_size spec type
Lex-MUTTDATA Jun 3, 2022
f7ec32d
Update request_params lookback window type
Lex-MUTTDATA Jun 3, 2022
cbb0891
Update lookback explicit name
Lex-MUTTDATA Jun 3, 2022
581af4f
Update state object declaration
Lex-MUTTDATA Jun 3, 2022
f66a5d7
Update request_params start_date
Lex-MUTTDATA Jun 3, 2022
4a8c3d0
update page_size var name
Lex-MUTTDATA Jun 5, 2022
3c026ff
Update logic read_records incremental function
Lex-MUTTDATA Jun 5, 2022
0e7fdf3
add/fix suggestions
Lex-MUTTDATA Jun 5, 2022
e62399f
to merge
Lex-MUTTDATA Jun 5, 2022
5f3f5bd
rollback bumped up version manually
Lex-MUTTDATA Jun 9, 2022
5f37b11
rollback page_size source.py
Lex-MUTTDATA Jun 9, 2022
c57a7a6
rollback page_size source.py - 2
Lex-MUTTDATA Jun 9, 2022
c9e5c36
rollback page_size spec.json
Lex-MUTTDATA Jun 9, 2022
e80ad3a
rollback page_size streams.py
Lex-MUTTDATA Jun 9, 2022
ffac4c3
setting default max page_size value
Lex-MUTTDATA Jun 9, 2022
e4067ee
change page_size variable name
Lex-MUTTDATA Jun 9, 2022
f4dc6e2
nit to avoid timedelta import
Lex-MUTTDATA Jun 9, 2022
87e5618
nit for readability
Lex-MUTTDATA Jun 9, 2022
70bc769
Update docker-compose.yaml
Lex-MUTTDATA Jun 9, 2022
fb01bde
Update source_specs.yaml
Lex-MUTTDATA Jun 9, 2022
31acf22
lookback_window description update
Lex-MUTTDATA Jun 10, 2022
220f16d
delete comma spec.json
Lex-MUTTDATA Jun 10, 2022
630cbd0
incremental_stream_kwargs - lookback_window config
Lex-MUTTDATA Jun 10, 2022
5107ca8
update streams-py - state.setter
Lex-MUTTDATA Jun 10, 2022
85dc8ae
update streams.py - request params start_date
Lex-MUTTDATA Jun 10, 2022
182d56e
update stream_slices fn in media_messages stream
Lex-MUTTDATA Jun 13, 2022
16d91da
wip
alafanechere Jun 17, 2022
3d3e4cf
wip
alafanechere Jun 17, 2022
51a726b
wip
alafanechere Jun 17, 2022
c376d72
fix typos
alafanechere Jun 20, 2022
cec36ca
Merge branch 'master' into augustin/source-twilio/implement-lookback-…
alafanechere Jun 22, 2022
0bd8056
make test pass
alafanechere Jun 22, 2022
6b363be
implement lookback
alafanechere Jun 22, 2022
b78fa93
Merge branch 'master' into augustin/source-twilio/implement-lookback-…
alafanechere Jun 22, 2022
8b58c77
fix merge type
alafanechere Jun 22, 2022
0d077db
Merge branch 'master' into augustin/source-twilio/implement-lookback-…
alafanechere Jun 22, 2022
df95ed7
update twilio readme
alafanechere Jun 22, 2022
f7b4b68
auto-bump connector version
octavia-squidington-iii Jun 22, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@
- name: Twilio
sourceDefinitionId: b9dc6155-672e-42ea-b10d-9f1f1fb95ab1
dockerRepository: airbyte/source-twilio
dockerImageTag: 0.1.4
dockerImageTag: 0.1.5
documentationUrl: https://docs.airbyte.io/integrations/sources/twilio
icon: twilio.svg
sourceType: api
Expand Down
13 changes: 12 additions & 1 deletion airbyte-config/init/src/main/resources/seed/source_specs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9248,7 +9248,7 @@
oauthFlowOutputParameters:
- - "token"
- - "key"
- dockerImage: "airbyte/source-twilio:0.1.4"
- dockerImage: "airbyte/source-twilio:0.1.5"
spec:
documentationUrl: "https://docs.airbyte.io/integrations/sources/twilio"
connectionSpecification:
Expand All @@ -9266,11 +9266,13 @@
description: "Twilio account SID"
airbyte_secret: true
type: "string"
order: 1
auth_token:
title: "Auth Token"
description: "Twilio Auth Token."
airbyte_secret: true
type: "string"
order: 2
start_date:
title: "Replication Start Date"
description: "UTC date and time in the format 2020-10-01T00:00:00Z. Any\
Expand All @@ -9279,6 +9281,15 @@
examples:
- "2020-10-01T00:00:00Z"
type: "string"
order: 3
lookback_window:
title: "Lookback window"
description: "How far into the past to look for records. (in minutes)"
examples:
- 60
default: 0
type: "integer"
order: 4
supportsIncremental: true
supportsNormalization: false
supportsDBT: false
Expand Down
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-twilio/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ RUN pip install .
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.1.4
LABEL io.airbyte.version=0.1.5
LABEL io.airbyte.name=airbyte/source-twilio
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ tests:
# usage records stream produces and error if cursor date gte than current date
configured_catalog_path: "integration_tests/no_empty_streams_no_usage_records_catalog.json"
future_state_path: "integration_tests/abnormal_state.json"
cursor_paths:
calls: ["end_time"]
conferences: ["date_updated"]
recordings: ["date_created"]
messages: ["date_sent"]
message_media: ["date_created"]
alerts: ["date_updated"]
- config_path: "secrets/config_with_lookback.json"
# usage records stream produces and error if cursor date gte than current date
configured_catalog_path: "integration_tests/no_empty_streams_no_usage_records_catalog.json"
future_state_path: "integration_tests/abnormal_state.json"
threshold_days: 30
full_refresh:
- config_path: "secrets/config.json"
# `constant_records_catalog.json` does not contain the available phone numbers streams,
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"calls": {
"end_time": "2220-10-01T00:00:00Z"
"end_time": "2030-10-01T00:00:00Z"
},
"conferences": {
"date_updated": "2220-10-01T00:00:00Z"
"date_created": "2030-10-01T00:00:00Z"
},
"recordings": {
"date_created": "2220-10-01T00:00:00Z"
"date_created": "2030-10-01T00:00:00Z"
},
"messages": {
"date_sent": "2220-10-01T00:00:00Z"
"date_sent": "2030-10-01T00:00:00Z"
},
"message_media": {
"date_created": "2220-10-01T00:00:00Z"
"date_created": "2030-10-01T00:00:00Z"
},
"alerts": {
"date_updated": "2220-10-01T00:00:00Z"
"date_generated": "2030-10-01T00:00:00Z"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@
"json_schema": {},
"supported_sync_modes": ["incremental", "full_refresh"],
"source_defined_cursor": true,
"default_cursor_field": ["date_updated"]
"default_cursor_field": ["date_created"]
},
"cursor_field": ["date_updated"],
"cursor_field": ["date_created"],
"sync_mode": "incremental",
"destination_sync_mode": "append"
},
Expand Down Expand Up @@ -213,9 +213,9 @@
"json_schema": {},
"supported_sync_modes": ["incremental", "full_refresh"],
"source_defined_cursor": true,
"default_cursor_field": ["date_updated"]
"default_cursor_field": ["date_created"]
},
"cursor_field": ["date_updated"],
"cursor_field": ["date_created"],
"sync_mode": "incremental",
"destination_sync_mode": "append"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
"json_schema": {},
"supported_sync_modes": ["incremental", "full_refresh"],
"source_defined_cursor": true,
"default_cursor_field": ["date_updated"]
"default_cursor_field": ["date_created"]
},
"cursor_field": ["date_updated"],
"cursor_field": ["date_created"],
"sync_mode": "incremental",
"destination_sync_mode": "append"
},
Expand Down Expand Up @@ -159,9 +159,9 @@
"json_schema": {},
"supported_sync_modes": ["incremental", "full_refresh"],
"source_defined_cursor": true,
"default_cursor_field": ["date_updated"]
"default_cursor_field": ["date_created"]
},
"cursor_field": ["date_updated"],
"cursor_field": ["date_created"],
"sync_mode": "incremental",
"destination_sync_mode": "append"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@
"json_schema": {},
"supported_sync_modes": ["incremental", "full_refresh"],
"source_defined_cursor": true,
"default_cursor_field": ["date_updated"]
"default_cursor_field": ["date_created"]
},
"cursor_field": ["date_updated"],
"cursor_field": ["date_created"],
"sync_mode": "incremental",
"destination_sync_mode": "append"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@
"json_schema": {},
"supported_sync_modes": ["incremental", "full_refresh"],
"source_defined_cursor": true,
"default_cursor_field": ["date_updated"]
"default_cursor_field": ["date_created"]
},
"cursor_field": ["date_updated"],
"cursor_field": ["date_created"],
"sync_mode": "incremental",
"destination_sync_mode": "append"
},
Expand Down Expand Up @@ -183,9 +183,9 @@
"json_schema": {},
"supported_sync_modes": ["incremental", "full_refresh"],
"source_defined_cursor": true,
"default_cursor_field": ["date_updated"]
"default_cursor_field": ["date_created"]
},
"cursor_field": ["date_updated"],
"cursor_field": ["date_created"],
"sync_mode": "incremental",
"destination_sync_mode": "append"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"calls": {
"end_time": "2020-01-01T00:00:00Z"
"end_time": "2022-06-11T00:00:00Z"
},
"conferences": {
"date_updated": "2020-01-01T00:00:00Z"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"type": ["null", "string"]
},
"date_updated": {
"format": "date",
"format": "date-time",
"type": ["null", "string"]
},
"api_version": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
"error_code": {
"type": ["null", "integer"]
},
"media_url": {
"type": ["null", "string"]
},
"uri": {
"type": ["null", "string"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"type": ["null", "number"]
},
"start_date": {
"format": "date",
"format": "date-time",
"type": ["null", "string"]
},
"count_unit": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]:
),
)
full_refresh_stream_kwargs = {"authenticator": auth}
incremental_stream_kwargs = {"authenticator": auth, "start_date": config["start_date"]}
incremental_stream_kwargs = {
"authenticator": auth,
"start_date": config["start_date"],
"lookback_window": config["lookback_window"],
}

streams = [
Accounts(**full_refresh_stream_kwargs),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,51 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Twilio Spec",
"type": "object",
"required": ["account_sid", "auth_token", "start_date"],
"required": [
"account_sid",
"auth_token",
"start_date"
],
"additionalProperties": false,
"properties": {
"account_sid": {
"title": "Account ID",
"description": "Twilio account SID",
"airbyte_secret": true,
"type": "string"
"type": "string",
"order": 1
},
"auth_token": {
"title": "Auth Token",
"description": "Twilio Auth Token.",
"airbyte_secret": true,
"type": "string"
"type": "string",
"order": 2
},
"start_date": {
"title": "Replication Start Date",
"description": "UTC date and time in the format 2020-10-01T00:00:00Z. Any data before this date will not be replicated.",
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$",
"examples": ["2020-10-01T00:00:00Z"],
"type": "string"
"examples": [
"2020-10-01T00:00:00Z"
],
"type": "string",
"order": 3
},
"lookback_window": {
"title": "Lookback window",
"description": "How far into the past to look for records. (in minutes)",
"examples": [
60
],
"default": 0,
"type": "integer",
"order": 4
}
}
},
"supportsIncremental": true,
"supported_destination_sync_modes": ["append"]
"supported_destination_sync_modes": [
"append"
]
}
Loading