-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
🎉 New source: Native Hubspot connector #2215
Conversation
/test connector=source-hubspot
|
/test connector=source-hubspot
|
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.
Looks good so far, I really like the breakdown of classes between API
, StreamAPI, and CRMObjects 🚀
@@ -78,8 +78,13 @@ | |||
dockerRepository: airbyte/source-facebook-marketing | |||
dockerImageTag: 0.1.3 | |||
documentationUrl: https://hub.docker.com/r/airbyte/source-facebook-marketing | |||
- sourceDefinitionId: 57eb1576-8f52-463d-beb6-2e107cdf571d | |||
- sourceDefinitionId: 36c891d9-4bd9-43ac-bad2-10e12756272c |
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.
We should only make the new version available once incremental is complete. We can then also completely remove the old hubspot connector (rather than rename it).
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.
my intention was to add a completely new connector, then release it and drop the one that based on singer. But maybe accidentally renamed the old instead, not sure, need to check
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.
Important thing is not to have 2 hubspot connectors in Airbyte at the same time. the user only cares about syncing data from hubspot, Singer vs. native is an implementation detail
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.
clear, I have removed the old connector
return {} | ||
|
||
props = {} | ||
data = self._api.get(f"/properties/v2/{self.entity}/properties") |
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.
can you add context on what this is doing as a comment?
I've looked at the API docs for a bit and it's not obvious to me what this is doing. it seems like it's adding the type of the property based on dynamically getting it from the Hubspot API? is this related to this ticket? why wouldn't we know the type of the property ahead of time?
This is bringing me to a different point: can you clarify as a docstring at the top of this class what the different APIs we are using are, and point to the API docs? This will enable me as the reader to know exactly which API docs to look at (Hubspot has multiple)
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.
most objects in Hubspot have attributes located in the properties field, there are two types:
- default (built-in, depends on the version of API)
- custom (user-defined)
because the exact list and types are dynamic we retrieve them at runtime. Technically we don't need to know type of attribute here, but for building a schema object we will need it (#2219 )
good idea about adding docs, will polish the PR soon
entity = None | ||
|
||
more_key = None | ||
data_path = "results" |
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.
data_path
is a bit misleading as a name since it's a single key, not a path in the JSON. Can we use something like data_field
?
page_filter = "offset" | ||
page_field = "offset" | ||
|
||
chunk_size = 1000 * 60 * 60 * 24 # TODO: use interval |
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.
I'm adding all TODOs to a checklist in the PR description so we don't miss these before merging
params = { | ||
"archived": str(self._include_archived_only).lower(), | ||
} | ||
for record in self.read(partial(self._api.get, url=self.url), params): |
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.
yield from?
if response.get(self.data_path) is None: | ||
raise RuntimeError("Unexpected API response: {} not in {}".format(self.data_path, response.keys())) | ||
|
||
for row in response[self.data_path]: |
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.
yield from?
url = "/crm/v3/objects/quotes" | ||
|
||
|
||
class TicketsAPI(CRMObjectsAPI): |
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.
why does every class have API
in the name? Shouldn't it just be the API
class and then everything else is a stream?
|
||
def _contacts_by_company(self, company_id): | ||
url = "/companies/v2/companies/{pk}/vids".format(pk=company_id) | ||
# FIXME: check if pagination is possible |
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.
added to todo list
docs/integrations/sources/hubspot.md
Outdated
* Campaigns | ||
* Companies | ||
* Contact Lists | ||
* Contacts |
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.
can you link to these in the docs? You don't have to link to each one individually, you can just link to one page at the top containing all of themnm
if data.get(path) is None: | ||
raise RuntimeError("Unexpected API response: {} not in {}".format(path, data.keys())) | ||
|
||
for row in data[path]: |
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.
is the point of this stream to be a join table between contacts and companies? can't we put this information in the contacts stream as a field?
/test connector=source-hubspot
|
] | ||
|
||
TEST_REQUIREMENTS = [ | ||
"airbyte-python-test", |
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.
airbyte-python-test is not needed
docs/integrations/sources/hubspot.md
Outdated
@@ -34,5 +50,5 @@ The connector is restricted by normal Hubspot [rate limitations](https://legacyd | |||
|
|||
* For api key auth, in Hubspot, for the account to go settings -> integrations \(under the account banner\) -> api key. If you already have an api key you can use that. Otherwise generated a new one. |
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.
As far as I can tell, this connector/airbyte would need to implement oauth for a client to be able to obtain oauth credentials. Since we don't do this yet, can you remove the oauth section from the docs and create an issue to support it once we have oauth? blocked on this issue: #768
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.
ok #2449
* add incremental * add incremental * polishing * update docs * fix docstring * clean up * fix incremental bookmark access * fix incremental tests * clean up * add custom test for incremental, improve logging * format * Update airbyte-integrations/connectors/source-hubspot/source_hubspot/api.py Co-authored-by: Eugene Kulak <[email protected]> Co-authored-by: Sherif A. Nada <[email protected]>
* fix error reporting and add unit tests * fix test and refactor cursor fields * format Co-authored-by: Eugene Kulak <[email protected]>
/test connector=source-hubspot
|
/test connector=source-hubspot
|
/test connector=source-hubspot
|
/publish connector=source-hubspot
|
/publish connector=connectors/source-hubspot
|
What
closes #2195
closes #2215
How
Describe the solution
Pre-merge Checklist
Recommended reading order
test.java
component.ts
TODOs: