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 Hubspot: Migrate to CDK #10177
Conversation
@@ -34,8 +34,8 @@ tests: | |||
future_state_path: "integration_tests/abnormal_state.json" | |||
cursor_paths: | |||
subscription_changes: ["timestamp"] | |||
email_events: ["timestamp"] | |||
contact_lists: ["timestamp"] | |||
email_events: ["created"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it matches the cursor_field in a stream (catalog) then you don't need cusor_paths for this stream (and any of them)
the purpose of cursor_paths
is to handle cases when the path in the STATE file is nested
"some_field": {
"cursor_field": "value"
}
/test connector=connectors/source-hubspot
|
/test connector=connectors/source-hubspot
|
/test connector=connectors/source-hubspot
|
/publish connector=connectors/source-hubspot
|
What
Resolves #5114
Refactor the connector to use CDK classes.
How
Make SourceHubspot inherits from AbstractSource
check_connection
, we can use the existing logic prodived by client.health_check in this methodstream.name
property sodiscover
command can find the related schemas and add dynamic properties by overridingget_json_schema
method. To do that refactor stream class names. Schema names should not be changed to support backward compatibilty.streams
method, move logic inClient._apis
to this method and change the its type from dict to list.Client
class.Refactor Stream classes
airbyte_cdk.sources.streams.core import Stream
IncrementalStream
stream as support incremental by adding fieldcursor_field
get_updated_state
toIncrementalStream
class, which returnsself.state or {self.state_pk: self._start_date}
IMO, we should not change
state
property because it has complex logic of handling stream state.read_records
method to Stream class, which runs generatorlist_records(fields=fields)
read_records
method inIncrementalStream
so it sets initial state got from connector state:Recommended reading order
source-hubspot/source_hubspot/source.py
source-hubspot/source_hubspot/api.py
source-hubspot/source_hubspot/client.py
source-hubspot/source_hubspot/test_source.py
source-hubspot/acceptance-test-config.yml