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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃毃馃毃 Source Sendgrid: migrate to low code #35776

Merged
merged 48 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
5e1004a
Migrated manifest
bleonard Mar 3, 2024
bb47c72
Updating unit tests
bleonard Mar 3, 2024
47b1e84
Updates the spec
bleonard Mar 3, 2024
64c6c91
Ignore __init__
bleonard Mar 3, 2024
74ef7b3
Better error message for failure case
bleonard Mar 3, 2024
1ce980e
Remove manifest schemas
bleonard Mar 3, 2024
95b4e07
Run formatter
bleonard Mar 4, 2024
7adc3a1
Not actually being used. In manifest now
bleonard Mar 4, 2024
323baec
These are not being used because it鈥檚 only one stream
bleonard Mar 4, 2024
f5c18b6
Adds descriptions
bleonard Mar 4, 2024
4a998a4
Switch to integers
bleonard Mar 4, 2024
d3de4eb
Stream code no longer exists
bleonard Mar 4, 2024
91090d1
Use host == base_url
bleonard Mar 4, 2024
af3704d
Merge branch 'master' into sendgrid_yaml
bleonard Mar 5, 2024
ca5df43
Config migration
bleonard Mar 7, 2024
0b24d9e
Merge branch 'master' into sendgrid_yaml
bleonard Mar 7, 2024
358df63
Change to 0.50 version
bleonard Mar 7, 2024
8d12dbc
Fix formatting
bleonard Mar 7, 2024
9a8c625
Note breaking change
bleonard Mar 7, 2024
6119c9b
Fix unit tests with the new base url
bleonard Mar 7, 2024
4865db3
Go back to 0.65
bleonard Mar 7, 2024
5c119de
New incremental stream
bleonard Mar 10, 2024
c961c3f
Update expected records
bleonard Mar 10, 2024
6d40d29
Upgrade to newest CDK
bleonard Mar 10, 2024
a2b5d13
format
bleonard Mar 10, 2024
9afc848
Merge branch 'master' into sendgrid_yaml
bleonard Mar 11, 2024
2917195
Migration guide
bleonard Mar 12, 2024
0839111
typo
bleonard Mar 12, 2024
76b77f5
changelog
bleonard Mar 12, 2024
a8c737c
Update config
bleonard Mar 12, 2024
7abae02
Use this config
bleonard Mar 13, 2024
f938e72
Leave the old values in for backwards migration
bleonard Mar 13, 2024
3c75a44
Bump airbyte-cdk
bleonard Mar 15, 2024
c0a246a
Merge branch 'master' into sendgrid_yaml
bleonard Mar 16, 2024
0a5176e
Handle epoch time input format
bleonard Mar 16, 2024
a1cfeeb
Merge branch 'master' into sendgrid_yaml
Mar 31, 2024
2549a46
Resolve conflicts
Mar 31, 2024
dd85496
Updated per comments
Mar 31, 2024
0e45486
Update docs
Apr 1, 2024
9ed7141
Align schemas
Apr 1, 2024
640ff8d
Delete step and cursor_granularity params from incremental sync
Apr 2, 2024
91ba85f
Merge branch 'master' into sendgrid_yaml
Apr 2, 2024
7d210eb
Merge branch 'master' into sendgrid_yaml
erohmensing Apr 2, 2024
547cc4b
Update primary keys
Apr 9, 2024
cf1ed6e
Bump CDK version
Apr 11, 2024
3ce907a
Update docs
Apr 12, 2024
82f2d76
Merge branch 'master' into sendgrid_yaml
Apr 12, 2024
1f9d30b
Merge branch 'master' into sendgrid_yaml
Apr 15, 2024
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 @@ -299,6 +299,8 @@ async def discovered_catalog_fixture(

output = await docker_runner.call_discover(config=connector_config)
catalogs = [message.catalog for message in output if message.type == Type.CATALOG]
if len(catalogs) == 0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this just merged from master, or is this new?

raise ValueError("No catalog message was emitted")
return {stream.name: stream for stream in catalogs[-1].streams}


Expand All @@ -322,6 +324,8 @@ async def previous_discovered_catalog_fixture(
)
return None
catalogs = [message.catalog for message in output if message.type == Type.CATALOG]
if len(catalogs) == 0:
raise ValueError("No catalog message was emitted")
return {stream.name: stream for stream in catalogs[-1].streams}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[run]
omit =
source_sendgrid/run.py
source_sendgrid/__init__.py
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-sendgrid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ See `sample_files/sample_config.json` for a sample config file.
poetry run source-sendgrid spec
poetry run source-sendgrid check --config secrets/config.json
poetry run source-sendgrid discover --config secrets/config.json
poetry run source-sendgrid read --config secrets/config.json --catalog sample_files/configured_catalog.json
poetry run source-sendgrid read --config secrets/config.json --catalog integration_tests/configured_catalog.json
```

### Running unit tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,35 @@ acceptance_tests:
spec:
tests:
- spec_path: "source_sendgrid/spec.json"
config_path: "secrets/lowcode_config.json"
backward_compatibility_tests_config:
disable_for_version: "0.3.0"
disable_for_version: "0.5.0"
connection:
tests:
- config_path: "secrets/config.json"
- config_path: "secrets/lowcode_config.json"
status: "succeed"
- config_path: "secrets/old_config.json"
status: "succeed"
- config_path: "secrets/python_config.json"
status: "succeed"
- config_path: "integration_tests/invalid_time.json"
status: "failed"
- config_path: "integration_tests/invalid_api_key.json"
status: "failed"
discovery:
tests:
- config_path: "secrets/lowcode_config.json"
backward_compatibility_tests_config:
disable_for_version: "1.0.0"
- config_path: "secrets/config.json"
backward_compatibility_tests_config:
disable_for_version: "0.3.0"
- config_path: "secrets/python_config.json"
backward_compatibility_tests_config:
disable_for_version: "0.3.0"
basic_read:
tests:
- config_path: "secrets/config.json"
- config_path: "secrets/lowcode_config.json"
expect_records:
path: "integration_tests/expected_records.jsonl"
exact_order: no
Expand All @@ -37,11 +46,11 @@ acceptance_tests:
fail_on_extra_columns: false
incremental:
tests:
- config_path: "secrets/config.json"
- config_path: "secrets/lowcode_config.json"
configured_catalog_path: "integration_tests/no_spam_reports_configured_catalog.json"
future_state:
future_state_path: "integration_tests/abnormal_state.json"
full_refresh:
tests:
- config_path: "secrets/config.json"
- config_path: "secrets/lowcode_config.json"
configured_catalog_path: "integration_tests/configured_catalog.json"
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,16 @@
"name": "invalid_emails"
}
}
},
{
Copy link
Collaborator

@lazebnyi lazebnyi Mar 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we adding incremental sync type for suppression_group_members?
If yes, we need to mention this in the documentation under the streams list.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this stream is now incremental - added a note to the Supported Streams list

"type": "STREAM",
"stream": {
"stream_state": {
"created_at": "7270247822"
},
"stream_descriptor": {
"name": "suppression_group_members"
}
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,16 @@
},
{
"stream": {
"name": "single_sends",
"name": "singlesends",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "singlesend_stats",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
Expand Down Expand Up @@ -140,15 +149,6 @@
"sync_mode": "incremental",
"cursor_field": ["created"],
"destination_sync_mode": "append"
},
{
"stream": {
"name": "unsubscribe_groups",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@
{"stream":"contacts","data":{"email":"fake_email_15@lmail.c","first_name":"Fake contact","last_name":"Lastname","address_line_1":null,"address_line_2":null,"city":null,"state_province_region":null,"postal_code":"22341","country":null,"alternate_emails":null,"phone_number":null,"whatsapp":null,"line":null,"facebook":null,"unique_name":null,"created_at":"2021-02-01T12:35:27Z","updated_at":"2021-02-01T12:35:56Z","contact_id":"50b36a31-daf8-45c4-bc48-13e150f6746e"},"emitted_at":1674825613540}
{"stream":"contacts","data":{"email":"fake_email_3@lmail.c","first_name":"Fake contact","last_name":"Lastname","address_line_1":null,"address_line_2":null,"city":null,"state_province_region":null,"postal_code":"22341","country":null,"alternate_emails":null,"phone_number":null,"whatsapp":null,"line":null,"facebook":null,"unique_name":null,"created_at":"2021-02-01T12:35:14Z","updated_at":"2021-02-01T12:35:43Z","contact_id":"d1211b88-e116-4a0b-a823-0361bf059a06"},"emitted_at":1674825613540}
{"stream":"contacts","data":{"email":"fake_email_18@lmail.c","first_name":"Fake contact","last_name":"Lastname","address_line_1":null,"address_line_2":null,"city":null,"state_province_region":null,"postal_code":"22341","country":null,"alternate_emails":null,"phone_number":null,"whatsapp":null,"line":null,"facebook":null,"unique_name":null,"created_at":"2021-02-01T12:35:30Z","updated_at":"2021-02-01T12:36:00Z","contact_id":"19163421-bb29-495d-950f-edede6218081"},"emitted_at":1674825613540}
{"stream": "single_sends", "data": {"ab_phase": "all", "ab_variation": "all", "aggregation": "total", "stats": {"bounce_drops": 0, "bounces": 0, "clicks": 0, "unique_clicks": 0, "delivered": 1, "invalid_emails": 0, "opens": 3, "unique_opens": 1, "requests": 1, "spam_report_drops": 0, "spam_reports": 0, "unsubscribes": 1}, "id": "3c5a9fa6-1084-11ec-ac32-4228d699bad5"}, "emitted_at": 1631093373000}
{"stream": "single_sends", "data": {"ab_phase": "all", "ab_variation": "all", "aggregation": "total", "stats": {"bounce_drops": 0, "bounces": 0, "clicks": 1, "unique_clicks": 1, "delivered": 1, "invalid_emails": 0, "opens": 1, "unique_opens": 1, "requests": 1, "spam_report_drops": 0, "spam_reports": 0, "unsubscribes": 0}, "id": "c9f286fb-1083-11ec-ae03-ca0fc7f28419"}, "emitted_at": 1631093373000}
{"stream": "singlesend_stats", "data": {"ab_phase": "all", "ab_variation": "all", "aggregation": "total", "stats": {"bounce_drops": 0, "bounces": 0, "clicks": 1, "unique_clicks": 1, "delivered": 1, "invalid_emails": 0, "opens": 1, "unique_opens": 1, "requests": 1, "spam_report_drops": 0, "spam_reports": 0, "unsubscribes": 0}, "id": "c9f286fb-1083-11ec-ae03-ca0fc7f28419"}, "emitted_at": 1710090955628}
{"stream": "singlesend_stats", "data": {"ab_phase": "all", "ab_variation": "all", "aggregation": "total", "stats": {"bounce_drops": 0, "bounces": 0, "clicks": 0, "unique_clicks": 0, "delivered": 1, "invalid_emails": 0, "opens": 3, "unique_opens": 1, "requests": 1, "spam_report_drops": 0, "spam_reports": 0, "unsubscribes": 1}, "id": "3c5a9fa6-1084-11ec-ac32-4228d699bad5"}, "emitted_at": 1710090955627}
{"stream": "templates", "data": {"id": "d-9e5be59949e043e69f3df003e715b99b", "name": "test_dynamic_template", "generation": "dynamic", "updated_at": "2021-02-03 14:56:56", "versions": []}, "emitted_at": 1631093374000}
{"stream": "templates", "data": {"id": "93702a5d-4cb2-4616-8d30-c2766e2b8e18", "name": "Template number 20", "generation": "legacy", "updated_at": "2021-02-03 13:31:29", "versions": []}, "emitted_at": 1631093374000}
{"stream": "templates", "data": {"id": "0fd7bcc7-7459-49e9-b9f3-4ace4f9a9ae2", "name": "Template number 19", "generation": "legacy", "updated_at": "2021-02-03 13:31:28", "versions": []}, "emitted_at": 1631093374000}
Expand Down Expand Up @@ -212,12 +212,12 @@
{"stream": "campaigns", "data": {"created_at": "2021-02-01T12:12:25Z", "id": "be9d147f-6486-11eb-8b51-8aa6caa37fdd", "name": "Third Campaign", "status": "draft", "updated_at": "2021-02-01T12:12:25Z", "is_abtest": false, "channels": ["email"]}, "emitted_at": 1678791750592}
{"stream": "campaigns", "data": {"created_at": "2021-02-01T12:12:18Z", "id": "ba43f256-6486-11eb-bb4f-823d082c01b8", "name": "Second Campaign", "status": "draft", "updated_at": "2021-02-01T12:12:18Z", "is_abtest": false, "channels": ["email"]}, "emitted_at": 1678791750593}
{"stream": "campaigns", "data": {"created_at": "2021-02-01T12:10:59Z", "id": "8b17a7b7-6486-11eb-bd77-2a301ccc59da", "name": "First Campaign", "status": "draft", "updated_at": "2021-02-01T12:10:59Z", "is_abtest": false, "channels": ["email"]}, "emitted_at": 1678791750593}
{"stream": "segments", "data": {"id": "37d93ee7-268e-4f6f-a103-384af7324b35", "name": "Everyone named Pol, POL or pol", "contacts_count": 0, "sample_updated_at": "2023-03-13T17:30:26Z", "next_sample_update": "2023-03-14T17:30:26Z", "created_at": "2021-02-03T13:23:13Z", "updated_at": "2021-02-03T13:23:13Z", "parent_list_id": null, "status": {"query_validation": "VALID"}}, "emitted_at": 1678791752069}
{"stream": "segments", "data": {"id": "bb3309ca-c002-4085-8d3e-de142dfa317e", "name": "Everyone named Jim, JIM or jim", "contacts_count": 0, "sample_updated_at": "2023-03-14T08:31:18Z", "next_sample_update": "2023-03-15T08:31:18Z", "created_at": "2021-02-03T13:19:50Z", "updated_at": "2021-02-03T13:19:50Z", "parent_list_id": "0236d6d2-75d2-42c5-962d-603e0deaf8d1", "status": {"query_validation": "VALID"}}, "emitted_at": 1678791752069}
{"stream": "segments", "data": {"id": "414d2eed-b2ba-4260-b3b4-e66369fafa43", "name": "Everyone named Bob, BOB or bob", "contacts_count": 0, "sample_updated_at": "2023-03-14T03:31:01Z", "next_sample_update": "2023-03-15T03:31:01Z", "created_at": "2021-02-03T13:18:50Z", "updated_at": "2021-02-03T13:18:50Z", "parent_list_id": "0236d6d2-75d2-42c5-962d-603e0deaf8d1", "status": {"query_validation": "VALID"}}, "emitted_at": 1678791752070}
{"stream": "segments", "data": {"id": "37d93ee7-268e-4f6f-a103-384af7324b35", "name": "Everyone named Pol, POL or pol", "query_version": "1", "contacts_count": 0, "sample_updated_at": "2024-03-09T17:30:18Z", "next_sample_update": "2024-03-10T17:30:18Z", "created_at": "2021-02-03T13:23:13Z", "updated_at": "2021-02-03T13:23:13Z", "parent_list_ids": null, "status": {"query_validation": "VALID"}}, "emitted_at": 1710091076235}
{"stream": "segments", "data": {"id": "bb3309ca-c002-4085-8d3e-de142dfa317e", "name": "Everyone named Jim, JIM or jim", "query_version": "1", "contacts_count": 0, "sample_updated_at": "2024-03-10T08:30:38Z", "next_sample_update": "2024-03-11T08:30:38Z", "created_at": "2021-02-03T13:19:50Z", "updated_at": "2021-02-03T13:19:50Z", "parent_list_ids": ["0236d6d2-75d2-42c5-962d-603e0deaf8d1"], "status": {"query_validation": "VALID"}}, "emitted_at": 1710091076236}
{"stream": "segments", "data": {"id": "414d2eed-b2ba-4260-b3b4-e66369fafa43", "name": "Everyone named Bob, BOB or bob", "query_version": "1", "contacts_count": 0, "sample_updated_at": "2024-03-10T03:30:41Z", "next_sample_update": "2024-03-11T03:30:41Z", "created_at": "2021-02-03T13:18:50Z", "updated_at": "2021-02-03T13:18:50Z", "parent_list_ids": ["0236d6d2-75d2-42c5-962d-603e0deaf8d1"], "status": {"query_validation": "VALID"}}, "emitted_at": 1710091076236}
{"stream": "stats_automations", "data": {"id": "85e3874b-6654-11eb-8a29-0e707ab27408", "step_id": "all", "aggregation": "total", "stats": {"bounce_drops": 0, "bounces": 6, "clicks": 0, "unique_clicks": 0, "delivered": 6, "invalid_emails": 0, "opens": 7, "unique_opens": 3, "requests": 12, "spam_report_drops": 0, "spam_reports": 0, "unsubscribes": 0}}, "emitted_at": 1678791758456}
{"stream": "unsubscribe_groups", "data": {"name": "Test Suggestions Group 0", "id": 14760, "description": "Suggestions for testing new stream.", "is_default": false, "unsubscribes": 0}, "emitted_at": 1684520573043}
{"stream": "unsubscribe_groups", "data": {"name": "Test Suggestions Group 1", "id": 14761, "description": "Suggestions for testing new stream.", "is_default": false, "unsubscribes": 0}, "emitted_at": 1684520573043}
{"stream": "unsubscribe_groups", "data": {"name": "Test Suggestions Group 2", "id": 14762, "description": "Suggestions for testing new stream.", "is_default": false, "unsubscribes": 0}, "emitted_at": 1684520573044}
{"stream": "unsubscribe_groups", "data": {"name": "Test Suggestions Group 3", "id": 14763, "description": "Suggestions for testing new stream.", "is_default": false, "unsubscribes": 0}, "emitted_at": 1684520573044}
{"stream": "unsubscribe_groups", "data": {"name": "Test Suggestions Group 4", "id": 14764, "description": "Suggestions for testing new stream.", "is_default": false, "unsubscribes": 0}, "emitted_at": 1684520573044}
{"stream": "singlesends", "data": {"id": "d497b877-6486-11eb-be53-b2a243c7228c", "name": "Campaign 18", "status": "draft", "categories": [], "send_at": null, "created_at": "2021-02-01T12:13:02Z", "updated_at": "2021-02-01T12:13:02Z", "is_abtest": false, "abtest": null}, "emitted_at": 1710090864093}
{"stream": "singlesends", "data": {"id": "c9f286fb-1083-11ec-ae03-ca0fc7f28419", "name": "Copy of Untitled Single Send", "status": "triggered", "categories": ["Promotional", "Travel & Hospitality"], "send_at": "2021-09-08T09:08:32Z", "created_at": "2021-09-08T09:04:36Z", "updated_at": "2021-09-08T09:09:08Z", "is_abtest": false, "abtest": null}, "emitted_at": 1710090864093}
{"stream": "singlesends", "data": {"id": "4e5be6a3-1082-11ec-8512-9afd40c324e6", "name": "Untitled Single Send", "status": "triggered", "categories": ["Promotional", "Travel & Hospitality"], "send_at": "2021-09-08T08:57:05Z", "created_at": "2021-09-08T08:53:59Z", "updated_at": "2021-09-08T08:57:08Z", "is_abtest": false, "abtest": null}, "emitted_at": 1710090864093}
{"stream": "singlesends", "data": {"id": "06ee105f-1082-11ec-8245-86a627812e3d", "name": "Untitled Single Send", "status": "triggered", "categories": [], "send_at": "2021-09-08T08:54:40Z", "created_at": "2021-09-08T08:51:59Z", "updated_at": "2021-09-08T08:55:08Z", "is_abtest": false, "abtest": null}, "emitted_at": 1710090864093}
{"stream": "singlesends", "data": {"id": "3c5a9fa6-1084-11ec-ac32-4228d699bad5", "name": "Untitled Single Send", "status": "triggered", "categories": ["Travel & Hospitality", "Loyalty"], "send_at": "2021-09-08T09:10:22Z", "created_at": "2021-09-08T09:07:48Z", "updated_at": "2021-09-08T09:11:08Z", "is_abtest": false, "abtest": null}, "emitted_at": 1710090864093}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"apikey": "wrong.api.key123"
"api_key": "wrong.api.key123"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"apikey": "apikey",
"start_time": "some erroneous input"
"api_key": "apikey",
"start_date": "some erroneous input"
bleonard marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,16 @@
},
{
"stream": {
"name": "single_sends",
"name": "singlesends",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "singlesend_stats",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
Expand Down
13 changes: 12 additions & 1 deletion airbyte-integrations/connectors/source-sendgrid/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@ data:
connectorSubtype: api
connectorType: source
definitionId: fbb5fbe2-16ad-4cf4-af7d-ff9d9c316c87
dockerImageTag: 0.5.0
dockerImageTag: 1.0.0
releases:
breakingChanges:
1.0.0:
message:
This release makes several changes that upgrade the Sendgrid connector.
The configuration options have been renamed to `api_key` and `start_date`. `start_date` is now required.
The `unsubscribe_groups` stream has been removed. It was the same as `suppression_groups`. You can use that and get the same data.
The `single_sends` stream has been renamed `singlesend_stats`. This is closer to the data and API.
The `segments` stream has been upgraded to use the Sendgrid 2.0 API because the older one has been deprecated. The schema has changed as a result.
To ensure a smooth upgrade, please refresh your schemas and reset your data before resuming syncs.
upgradeDeadline: "2024-04-15"
dockerRepository: airbyte/source-sendgrid
documentationUrl: https://docs.airbyte.com/integrations/sources/sendgrid
githubIssueLabel: source-sendgrid
Expand Down
Loading
Loading