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 Close.com: migration to low-code #18968

Merged
merged 12 commits into from
Dec 7, 2022

Conversation

roman-yermilov-gl
Copy link
Contributor

What

This is a migration to Low-code

How

Old code is still present but replaced with new Source Declarative class in __init__.py. Made custom Slicer and Pagination to support custom needs of the connector

# Declarative Source
class SourceCloseCom(YamlDeclarativeSource):
def __init__(self):
super().__init__(**{"path_to_yaml": "close_com.yaml"})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
super().__init__(**{"path_to_yaml": "close_com.yaml"})
super().__init__(path_to_yaml="close_com.yaml")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is an auto-generated code that no need to touch. This is how all the Source classes should look like

Copy link
Collaborator

Choose a reason for hiding this comment

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

🤷 okay

@@ -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.0
LABEL io.airbyte.version=0.1.1
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think a minor version should be bumped, not patch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nothing changed at all from functional perspective. Moreover we are using the same code as we used before, but just run it in another way. Should we really bump it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

but it does not look like a bugfix as well :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed

"incoming_sms_tasks", "zoom_connected_accounts", "custom_email_connected_accounts",
"google_connected_accounts", "send_as", "email_sequences", "dialer", "email_bulk_actions",
"sequence_subscription_bulk_actions", "delete_bulk_actions"]
empty_streams:
Copy link
Collaborator

Choose a reason for hiding this comment

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

there should be no empty streams if we're going to certify this connector to beta

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was trying to avoid empty streams but didn't succeed. We cannot to populate some tasks from our side and send_as requires payment. It also makes impossible for now to migrate SAT config to new version

@@ -14,10 +14,24 @@ tests:
basic_read:
Copy link
Collaborator

Choose a reason for hiding this comment

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

could you please migrate SAT config to the new version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

New version does not support empty_streams

Copy link
Collaborator

Choose a reason for hiding this comment

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

it does support empty streams but you need to define the bypass reason
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done



@dataclass
class OffsetIncrementWorkaround(PaginationStrategy, JsonSchemaMixin):
Copy link
Collaborator

Choose a reason for hiding this comment

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

could you please add a docstring explaining the difference between this class and other paginating strategies?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

$ref: "*ref(definitions.incremental_stream)"
stream_cursor_field: "date_created"
$options:
primary_key: "id"
Copy link
Collaborator

Choose a reason for hiding this comment

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

the primary key should be defined outside the options parameter

Copy link
Contributor Author

@roman-yermilov-gl roman-yermilov-gl Nov 7, 2022

Choose a reason for hiding this comment

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

I can put it here as well, if I need to specify it by primary_key per stream. But you are right, this key isn't used and was finally defined globally in base stream. It should be removed from here

@davydov-d
Copy link
Collaborator

what's the purpose of not removing the python code?

@roman-yermilov-gl roman-yermilov-gl temporarily deployed to more-secrets November 10, 2022 13:12 Inactive
@roman-yermilov-gl roman-yermilov-gl temporarily deployed to more-secrets November 10, 2022 14:26 Inactive
@roman-yermilov-gl roman-yermilov-gl temporarily deployed to more-secrets November 10, 2022 16:04 Inactive
@roman-yermilov-gl
Copy link
Contributor Author

what's the purpose of not removing the python code?

It is just an agreement

@roman-yermilov-gl roman-yermilov-gl force-pushed the ryermilov/source-close-com-migration branch from d6957c9 to 07f3b3f Compare November 11, 2022 14:32
@roman-yermilov-gl
Copy link
Contributor Author

roman-yermilov-gl commented Nov 11, 2022

/test connector=connectors/source-close-com

🕑 connectors/source-close-com https://github.com/airbytehq/airbyte/actions/runs/3445784181
✅ connectors/source-close-com https://github.com/airbytehq/airbyte/actions/runs/3445784181
Python tests coverage:

Name                                              Stmts   Miss  Cover
---------------------------------------------------------------------
source_close_com/offset_increment_workaround.py      24      0   100%
source_close_com/__init__.py                          4      0   100%
source_close_com/single_stream_slicer.py             64     13    80%
source_close_com/source_lc.py                         4      1    75%
---------------------------------------------------------------------
TOTAL                                                96     14    85%
	 Name                                                 Stmts   Miss  Cover   Missing
	 ----------------------------------------------------------------------------------
	 source_acceptance_test/base.py                          12      4    67%   16-19
	 source_acceptance_test/config.py                       139      5    96%   87, 93, 235, 239-240
	 source_acceptance_test/conftest.py                     196     92    53%   35, 41-43, 48, 54, 60, 66, 72-74, 93, 98-100, 106-108, 114-115, 120-121, 126, 132, 141-150, 156-161, 176, 200, 231, 237, 243-248, 256-261, 269-282, 287-293, 300-311, 318-334
	 source_acceptance_test/plugin.py                        69     25    64%   22-23, 31, 36, 120-140, 144-148
	 source_acceptance_test/tests/test_core.py              394    111    72%   53, 58, 87-95, 100-107, 111-112, 116-117, 293, 331-348, 357-365, 369-374, 380, 413-418, 456-463, 506-508, 511, 576-584, 596-599, 604, 660-661, 667, 670, 706-716, 729-754
	 source_acceptance_test/tests/test_incremental.py       158     14    91%   52-59, 64-77, 240
	 source_acceptance_test/utils/asserts.py                 37      2    95%   57-58
	 source_acceptance_test/utils/common.py                  94     10    89%   16-17, 32-38, 72, 75
	 source_acceptance_test/utils/compare.py                 62     23    63%   21-51, 68, 97-99
	 source_acceptance_test/utils/connector_runner.py       112     50    55%   23-26, 32, 36, 39-68, 71-73, 76-78, 81-83, 86-88, 91-93, 96-114, 148-150
	 source_acceptance_test/utils/json_schema_helper.py     105     13    88%   30-31, 38, 41, 65-68, 96, 120, 190-192
	 ----------------------------------------------------------------------------------
	 TOTAL                                                 1557    349    78%

Build Passed

Test summary info:

=========================== short test summary info ============================
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/tests/test_core.py:364: Backward compatibility tests are disabled for version 0.1.0.
================== 30 passed, 1 skipped in 642.55s (0:10:42) ===================

@roman-yermilov-gl roman-yermilov-gl temporarily deployed to more-secrets November 11, 2022 14:35 Inactive
@grubberr grubberr temporarily deployed to more-secrets November 13, 2022 17:02 Inactive
@grubberr grubberr temporarily deployed to more-secrets November 14, 2022 08:43 Inactive

def __post_init__(self, options: Mapping[str, Any]):
self._offset = 0
self.page_size = InterpolatedString.create(self.page_size, options=options)
Copy link
Contributor

Choose a reason for hiding this comment

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

@roman-yermilov-gl how about updating the paginator's field to be an interpolated string instead of duplicating the class for a one-line change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It may affect existing connectors that using page_size as integer?

Copy link
Contributor

Choose a reason for hiding this comment

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

page_size should always return an int, but the underlying field could be Union[InterpolatedString, str, int]

Copy link
Contributor Author

@roman-yermilov-gl roman-yermilov-gl Nov 22, 2022

Choose a reason for hiding this comment

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

Removed custom component, but need the following PR to be accepted:
#19646



@dataclass
class SingleStreamSlicer(SingleSlice):
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a benefit to using a single slice instead of chunking the time range like DatetimeStreamSlicer does? Using multiple slices is nice because it gives us checkpointing for free

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are streams that require a very small step, a millisecond or less. It looks like I cannot avoid customization

Copy link
Contributor

Choose a reason for hiding this comment

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

Fine with me if it has to be custom, but I'd like to better understand the limitation of the implementation in the CDK.

The DatetimeStreamSlicer's update_cursor method also updates the cursor based on the last record read, so I would expect it to fetch the same records even if they are in different slices

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Figured out how to avoid custom Slicer, so custom component is removed

@roman-yermilov-gl roman-yermilov-gl force-pushed the ryermilov/source-close-com-migration branch from 94c3ad6 to e9e37a7 Compare November 21, 2022 10:29
@roman-yermilov-gl roman-yermilov-gl temporarily deployed to more-secrets November 21, 2022 10:31 Inactive
@roman-yermilov-gl roman-yermilov-gl temporarily deployed to more-secrets November 21, 2022 15:39 Inactive
Copy link
Contributor

@girarda girarda left a comment

Choose a reason for hiding this comment

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

love it! Approved pending #19646

field_name: "_skip"
pagination_strategy:
type: OffsetIncrement
page_size: "{{ options['items_per_page'] }}"
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

@roman-yermilov-gl
Copy link
Contributor Author

roman-yermilov-gl commented Dec 6, 2022

/test connector=connectors/source-close-com

🕑 connectors/source-close-com https://github.com/airbytehq/airbyte/actions/runs/3631620509
❌ connectors/source-close-com https://github.com/airbytehq/airbyte/actions/runs/3631620509
🐛 https://gradle.com/s/fnpiy7gj2ndr4

Build Failed

Test summary info:

=========================== short test summary info ============================
FAILED test_core.py::TestBasicRead::test_read[inputs0] - Failed: Stream googl...
FAILED test_incremental.py::TestIncremental::test_two_sequential_reads[inputs0]
FAILED test_incremental.py::TestIncremental::test_read_sequential_slices[inputs0]
FAILED test_incremental.py::TestIncremental::test_state_with_abnormally_large_values[inputs0]
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/tests/test_core.py:370: Backward compatibility tests are disabled for version 0.1.0.
============= 4 failed, 26 passed, 1 skipped in 214.79s (0:03:34) ==============

@roman-yermilov-gl roman-yermilov-gl temporarily deployed to more-secrets December 6, 2022 19:22 Inactive
@roman-yermilov-gl roman-yermilov-gl temporarily deployed to more-secrets December 6, 2022 19:37 Inactive
@roman-yermilov-gl roman-yermilov-gl force-pushed the ryermilov/source-close-com-migration branch from 9d79545 to d373d86 Compare December 7, 2022 12:20
@roman-yermilov-gl roman-yermilov-gl temporarily deployed to more-secrets December 7, 2022 12:22 — with GitHub Actions Inactive
@roman-yermilov-gl roman-yermilov-gl temporarily deployed to more-secrets December 7, 2022 12:22 — with GitHub Actions Inactive
@roman-yermilov-gl
Copy link
Contributor Author

roman-yermilov-gl commented Dec 7, 2022

/test connector=connectors/source-close-com

🕑 connectors/source-close-com https://github.com/airbytehq/airbyte/actions/runs/3638859589
✅ connectors/source-close-com https://github.com/airbytehq/airbyte/actions/runs/3638859589
Python tests coverage:

	 Name                                                 Stmts   Miss  Cover   Missing
	 ----------------------------------------------------------------------------------
	 source_acceptance_test/base.py                          12      4    67%   16-19
	 source_acceptance_test/config.py                       140      5    96%   87, 93, 238, 242-243
	 source_acceptance_test/conftest.py                     208     92    56%   36, 42-44, 49, 54, 77, 83, 89-91, 110, 115-117, 123-125, 131-132, 137-138, 143, 149, 158-167, 173-178, 193, 217, 248, 254, 262-267, 275-280, 288-301, 306-312, 319-330, 337-353
	 source_acceptance_test/plugin.py                        69     25    64%   22-23, 31, 36, 120-140, 144-148
	 source_acceptance_test/tests/test_core.py              398    111    72%   53, 58, 87-95, 100-107, 111-112, 116-117, 299, 337-354, 363-371, 375-380, 386, 419-424, 462-469, 512-514, 517, 582-590, 602-605, 610, 666-667, 673, 676, 712-722, 735-760
	 source_acceptance_test/tests/test_incremental.py       158     14    91%   52-59, 64-77, 240
	 source_acceptance_test/utils/asserts.py                 39      2    95%   62-63
	 source_acceptance_test/utils/common.py                  94     10    89%   16-17, 32-38, 72, 75
	 source_acceptance_test/utils/compare.py                 62     23    63%   21-51, 68, 97-99
	 source_acceptance_test/utils/connector_runner.py       133     33    75%   24-27, 46-47, 50-54, 57-58, 73-75, 78-80, 83-85, 88-90, 93-95, 124-125, 159-161, 208
	 source_acceptance_test/utils/json_schema_helper.py     107     13    88%   30-31, 38, 41, 65-68, 96, 120, 192-194
	 ----------------------------------------------------------------------------------
	 TOTAL                                                 1599    332    79%

Build Passed

Test summary info:

=========================== short test summary info ============================
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/tests/test_core.py:370: Backward compatibility tests are disabled for version 0.1.0.
================== 30 passed, 1 skipped in 356.87s (0:05:56) ===================

@roman-yermilov-gl
Copy link
Contributor Author

roman-yermilov-gl commented Dec 7, 2022

/publish connector=connectors/source-close-com

🕑 Publishing the following connectors:
connectors/source-close-com
https://github.com/airbytehq/airbyte/actions/runs/3639089400


Connector Did it publish? Were definitions generated?
connectors/source-close-com

if you have connectors that successfully published but failed definition generation, follow step 4 here ▶️

@octavia-squidington-iii octavia-squidington-iii temporarily deployed to more-secrets December 7, 2022 13:22 — with GitHub Actions Inactive
@octavia-squidington-iii octavia-squidington-iii temporarily deployed to more-secrets December 7, 2022 13:23 — with GitHub Actions Inactive
@roman-yermilov-gl roman-yermilov-gl merged commit ab44197 into master Dec 7, 2022
@roman-yermilov-gl roman-yermilov-gl deleted the ryermilov/source-close-com-migration branch December 7, 2022 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues area/documentation Improvements or additions to documentation connectors/source/close-com
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants