Skip to content

Commit ca31888

Browse files
committed
minor fixes in pipedrive_pipeline,py
1 parent 4a7807f commit ca31888

File tree

1 file changed

+19
-22
lines changed

1 file changed

+19
-22
lines changed

sources/pipedrive_pipeline.py

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ def load_pipedrive() -> None:
1010
# configure the pipeline with your destination details
1111
pipeline = dlt.pipeline(
1212
pipeline_name="pipedrive",
13-
destination="duckdb",
13+
destination='duckdb',
1414
dataset_name="pipedrive_data",
1515
progress="log",
16-
dev_mode=True,
1716
)
1817
load_info = pipeline.run(pipedrive_source())
1918
print(load_info)
@@ -24,17 +23,15 @@ def load_selected_data() -> None:
2423
"""Shows how to load just selected tables using `with_resources`"""
2524
pipeline = dlt.pipeline(
2625
pipeline_name="pipedrive",
27-
destination="duckdb",
26+
destination='duckdb',
2827
dataset_name="pipedrive_data",
2928
progress="log",
30-
dev_mode=True,
3129
)
3230
# Use with_resources to select which entities to load
3331
# Note: `custom_fields_mapping` must be included to translate custom field hashes to corresponding names
3432
load_info = pipeline.run(
3533
pipedrive_source().with_resources(
36-
# "products", "deals", "deals_participants", "custom_fields_mapping"
37-
"deals"
34+
"products", "deals", "deals_participants", "custom_fields_mapping"
3835
)
3936
)
4037
print(load_info)
@@ -57,10 +54,9 @@ def load_from_start_date() -> None:
5754
"""Example to incrementally load activities limited to items updated after a given date"""
5855
pipeline = dlt.pipeline(
5956
pipeline_name="pipedrive",
60-
destination="duckdb",
57+
destination='duckdb',
6158
dataset_name="pipedrive_data",
6259
progress="log",
63-
dev_mode=True,
6460
)
6561

6662
# First source configure to load everything except activities from the beginning
@@ -78,35 +74,36 @@ def load_from_start_date() -> None:
7874

7975

8076
def load_v2_resources(resources: Optional[Sequence[str]] = None) -> None:
81-
"""Load v2 entities using the separate v2 source.
77+
"""Load v2 entities using the separate v2 source."""
8278

83-
Note: company_domain will be read from dlt secrets if not provided.
84-
"""
8579
resources = list(resources or DEFAULT_V2_RESOURCES)
8680
pipeline = dlt.pipeline(
8781
pipeline_name="pipedrive",
88-
destination="duckdb",
82+
destination='duckdb',
8983
dataset_name="pipedrive_data",
9084
progress="log",
91-
dev_mode=True,
9285
)
9386
source = pipedrive_v2_source(resources=resources)
9487
load_info = pipeline.run(source)
9588
print(load_info)
9689
print(pipeline.last_trace.last_normalize_info)
9790

9891

99-
def load_selected_v2_data(resources: Sequence[str]) -> None:
92+
def load_selected_v2_data() -> None:
10093
"""Load only the specified v2 entities (and their nested resources)."""
10194
pipeline = dlt.pipeline(
102-
pipeline_name="pipedrive",
95+
pipeline_name="pipedrive21",
10396
destination="duckdb",
104-
dataset_name="pipedrive_data",
97+
dataset_name="pipedrive_dat21a",
10598
progress="log",
106-
dev_mode=True,
10799
)
108-
source = pipedrive_v2_source(resources=list(resources))
109-
load_info = pipeline.run(source)
100+
# Use with_resources to select which entities to load (3 major v2 endpoints)
101+
# Note: v2 resources are prefixed with "v2_" in the source
102+
load_info = pipeline.run(
103+
pipedrive_v2_source().with_resources(
104+
"v2_deals", "v2_persons", "v2_organizations"
105+
)
106+
)
110107
print(load_info)
111108
print(pipeline.last_trace.last_normalize_info)
112109

@@ -119,6 +116,6 @@ def load_selected_v2_data(resources: Sequence[str]) -> None:
119116
# load activities updated since given date
120117
# load_from_start_date()
121118
# load v2 resources (optional addon)
122-
load_v2_resources()
123-
# load only selected v2 resources
124-
# load_selected_v2_data(["deals", "stages"])
119+
#load_v2_resources()
120+
# load only selected v2 resources (3 major endpoints: deals, persons, organizations)
121+
load_selected_v2_data()

0 commit comments

Comments
 (0)