Skip to content

Commit c7fe31a

Browse files
authored
[source-hubspot] - migrate deals_pipelinesto low code (#59195)
1 parent 1542c0f commit c7fe31a

File tree

9 files changed

+189
-139
lines changed

9 files changed

+189
-139
lines changed

airbyte-integrations/connectors/source-hubspot/metadata.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ data:
1010
connectorSubtype: api
1111
connectorType: source
1212
definitionId: 36c891d9-4bd9-43ac-bad2-10e12756272c
13-
dockerImageTag: 4.9.0
13+
dockerImageTag: 4.10.0
1414
dockerRepository: airbyte/source-hubspot
1515
documentationUrl: https://docs.airbyte.com/integrations/sources/hubspot
1616
erdUrl: https://dbdocs.io/airbyteio/source-hubspot?view=relationships

airbyte-integrations/connectors/source-hubspot/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
33
build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
6-
version = "4.9.0"
6+
version = "4.10.0"
77
name = "source-hubspot"
88
description = "Source implementation for HubSpot."
99
authors = [ "Airbyte <contact@airbyte.io>",]

airbyte-integrations/connectors/source-hubspot/source_hubspot/manifest.yaml

Lines changed: 148 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,14 +579,56 @@ definitions:
579579
type: KeyTransformation
580580
prefix: counters_
581581

582+
deal_pipelines_stream:
583+
$ref: "#/definitions/stream_base"
584+
name: deal_pipelines
585+
primary_key:
586+
- pipelineId
587+
retriever:
588+
type: SimpleRetriever
589+
requester:
590+
$ref: "#/definitions/base_requester"
591+
path: /crm-pipelines/v1/pipelines/deals
592+
record_selector:
593+
type: RecordSelector
594+
transform_before_filtering: true
595+
extractor:
596+
type: DpathExtractor
597+
field_path:
598+
- results
599+
decoder:
600+
type: JsonDecoder
601+
incremental_sync:
602+
type: DatetimeBasedCursor
603+
cursor_field: updatedAt
604+
start_datetime:
605+
type: MinMaxDatetime
606+
datetime: "{{ format_datetime(config.get('start_date', '2006-06-01T00:00:00Z'), '%ms', '%Y-%m-%dT%H:%M:%SZ') }}"
607+
datetime_format: "%ms"
608+
datetime_format: "%ms"
609+
lookback_window: P{{ config.get('lookback_window', 0) }}D
610+
cursor_datetime_formats:
611+
- "%ms"
612+
is_client_side_incremental: true
613+
schema_loader:
614+
type: InlineSchemaLoader
615+
schema:
616+
$ref: "#/schemas/deal_pipelines"
617+
transformations:
618+
- type: AddFields
619+
fields:
620+
- path: ["updatedAt"]
621+
value: "{{ record.get('updatedAt') or record['createdAt'] }}"
622+
582623
streams:
624+
- "#/definitions/campaigns_stream"
583625
- "#/definitions/companies_property_history_stream"
584626
- "#/definitions/contacts_property_history_stream"
627+
- "#/definitions/deal_pipelines_stream"
585628
- "#/definitions/deals_property_history_stream"
586629
- "#/definitions/email_subscriptions_stream"
587630
- "#/definitions/marketing_emails_stream"
588631
- "#/definitions/ticket_pipelines_stream"
589-
- "#/definitions/campaigns_stream"
590632

591633
# HubSpot account is limited to 110 requests every 10 seconds https://developers.hubspot.com/docs/guides/apps/api-usage/usage-details#rate-limits
592634
concurrency_level:
@@ -595,6 +637,111 @@ concurrency_level:
595637
max_concurrency: 40
596638

597639
schemas:
640+
deal_pipelines:
641+
$schema: http://json-schema.org/draft-07/schema#
642+
type:
643+
- "null"
644+
- object
645+
additionalProperties: true
646+
properties:
647+
label:
648+
description: The label or name of the deal pipeline.
649+
type:
650+
- "null"
651+
- string
652+
displayOrder:
653+
description: The ordering of the deal pipeline for display.
654+
type:
655+
- "null"
656+
- integer
657+
active:
658+
description: Indicates if the deal pipeline is currently active or not.
659+
type:
660+
- "null"
661+
- boolean
662+
stages:
663+
description: List of deal stages within the pipeline.
664+
type:
665+
- "null"
666+
- array
667+
items:
668+
type:
669+
- "null"
670+
- object
671+
properties:
672+
label:
673+
description: The label or name of the deal stage.
674+
type:
675+
- "null"
676+
- string
677+
displayOrder:
678+
description: The ordering of the deal stage for display within the pipeline.
679+
type:
680+
- "null"
681+
- integer
682+
metadata:
683+
description: Additional information related to the deal stage.
684+
type:
685+
- "null"
686+
- object
687+
properties:
688+
isClosed:
689+
description: Indicates if the deal stage is considered closed or not.
690+
type:
691+
- "null"
692+
- string
693+
probability:
694+
description: The probability of closing a deal at this stage.
695+
type:
696+
- "null"
697+
- string
698+
stageId:
699+
description: The unique identifier of the deal stage.
700+
type:
701+
- "null"
702+
- string
703+
createdAt:
704+
description: Timestamp for the creation date of the deal stage.
705+
type:
706+
- "null"
707+
- integer
708+
updatedAt:
709+
description: Timestamp for the last update to the deal stage.
710+
type:
711+
- "null"
712+
- integer
713+
active:
714+
description: Indicates if the deal stage is currently active or not.
715+
type:
716+
- "null"
717+
- boolean
718+
objectType:
719+
description: The type of object this deal pipeline is associated with.
720+
type:
721+
- "null"
722+
- string
723+
objectTypeId:
724+
description: The ID of the object type this deal pipeline is associated with.
725+
type:
726+
- "null"
727+
- string
728+
pipelineId:
729+
description: The unique identifier of the deal pipeline.
730+
type:
731+
- "null"
732+
- string
733+
createdAt:
734+
description: Timestamp for the creation date of the deal pipeline.
735+
type:
736+
- "null"
737+
- integer
738+
updatedAt:
739+
description: Timestamp for the last update to the deal pipeline.
740+
type:
741+
- "null"
742+
- integer
743+
default:
744+
description: Indicates if this pipeline is the default one in the system.
598745
companies_property_history:
599746
$schema: "http://json-schema.org/draft-07/schema"
600747
type:

airbyte-integrations/connectors/source-hubspot/source_hubspot/schemas/deal_pipelines.json

Lines changed: 0 additions & 89 deletions
This file was deleted.

airbyte-integrations/connectors/source-hubspot/source_hubspot/source.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
ContactsMergedAudit,
3030
ContactsWebAnalytics,
3131
CustomObject,
32-
DealPipelines,
3332
Deals,
3433
DealsArchived,
3534
DealSplits,
@@ -74,6 +73,7 @@
7473
scopes = {
7574
"companies_property_history": {"crm.objects.companies.read"},
7675
"contacts_property_history": {"crm.objects.contacts.read"},
76+
"deal_pipelines": {"crm.objects.contacts.read"},
7777
"deals_property_history": {"crm.objects.deals.read"},
7878
"email_subscriptions": {"content"},
7979
"marketing_emails": {"content"},
@@ -199,7 +199,6 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]:
199199
ContactsFormSubmissions(**common_params),
200200
ContactsListMemberships(**common_params),
201201
ContactsMergedAudit(**common_params),
202-
DealPipelines(**common_params),
203202
DealSplits(**common_params),
204203
Deals(**common_params),
205204
DealsArchived(**common_params),

airbyte-integrations/connectors/source-hubspot/source_hubspot/streams.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,20 +1578,6 @@ def request_params(
15781578
return params
15791579

15801580

1581-
class DealPipelines(ClientSideIncrementalStream):
1582-
"""Deal pipelines, API v1,
1583-
This endpoint requires the contacts scope the tickets scope.
1584-
Docs: https://legacydocs.hubspot.com/docs/methods/pipelines/get_pipelines_for_object_type
1585-
"""
1586-
1587-
url = "/crm-pipelines/v1/pipelines/deals"
1588-
updated_at_field = "updatedAt"
1589-
created_at_field = "createdAt"
1590-
cursor_field_datetime_format = "x"
1591-
primary_key = "pipelineId"
1592-
scopes = {"crm.objects.contacts.read"}
1593-
1594-
15951581
class DealSplits(CRMSearchStream):
15961582
"""Deal splits, API v3"""
15971583

0 commit comments

Comments
 (0)