Skip to content

Commit 38c7ded

Browse files
committed
minor fixes
1 parent 43c08a1 commit 38c7ded

File tree

3 files changed

+10
-21
lines changed

3 files changed

+10
-21
lines changed

sources/pipedrive/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,19 @@
99
To get an api key: https://pipedrive.readme.io/docs/how-to-find-the-api-token
1010
"""
1111

12-
from typing import Any, Dict, Iterator, List, Optional, Union, Iterator
12+
from typing import Any, Dict, Iterator, List, Optional, Union, Iterable
1313

1414
import dlt
15+
from dlt.common import pendulum
16+
from dlt.common.time import ensure_pendulum_datetime
17+
from dlt.common.typing import TDataItems
18+
from dlt.sources import DltResource
1519

1620
from .helpers.custom_fields_munger import update_fields_mapping, rename_fields
1721
from .helpers.pages import get_recent_items_incremental, get_pages
1822
from .helpers import group_deal_flows
1923
from .typing import TDataPage
2024
from .settings import ENTITY_MAPPINGS, RECENTS_ENTITIES
21-
from dlt.common import pendulum
22-
from dlt.common.time import ensure_pendulum_datetime
23-
from dlt.sources import DltResource, TDataItems
2425

2526
# Export v2 source for easy access
2627
from .rest_v2 import pipedrive_v2_source
@@ -30,7 +31,7 @@
3031
def pipedrive_source(
3132
pipedrive_api_key: str = dlt.secrets.value,
3233
since_timestamp: Optional[Union[pendulum.DateTime, str]] = "1970-01-01 00:00:00",
33-
) -> Iterator[DltResource]:
34+
) -> Iterable[DltResource]:
3435
"""
3536
Get data from the Pipedrive API. Supports incremental loading and custom fields mapping.
3637

sources/pipedrive/rest_v2/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Iterable, Dict, Any, List, Optional, Iterator, Union, cast
1+
from typing import Iterable, Dict, Any, List, Optional, Union, cast
22

33
import dlt
44
from dlt.sources import DltResource
@@ -14,7 +14,7 @@ def pipedrive_v2_source(
1414
company_domain: str = dlt.secrets.value,
1515
resources: Optional[List[str]] = None,
1616
prefix: str = "v2_",
17-
) -> Iterator[DltResource]:
17+
) -> Iterable[DltResource]:
1818
"""
1919
Get data from the Pipedrive API v2.
2020
@@ -109,8 +109,6 @@ def rest_v2_resources(
109109
nested_resource_def["primary_key"] = primary_key
110110
resources.append(nested_resource_def)
111111

112-
# Create config with proper typing
113-
# Cast resources to the expected type since our Dict[str, Any] matches EndpointResource structure
114112
config: RESTAPIConfig = {
115113
"client": {
116114
"base_url": f"https://{company_domain}.pipedrive.com/api/v2/",

sources/pipedrive/settings.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,7 @@
9393
"deal_followers": {
9494
"parent": "deals",
9595
"endpoint_path": "deals/{id}/followers",
96-
"primary_key": [
97-
"user_id",
98-
"_deals_id",
99-
], # Followers don't have 'id', use composite key
96+
"primary_key": ["user_id", "_deals_id"], # Followers don't have 'id', use composite key
10097
"include_from_parent": ["id"], # Include deal id from parent
10198
"params": {
10299
"limit": 500,
@@ -108,11 +105,4 @@
108105
# This curated set includes the most commonly used endpoints.
109106
# Users can customize this list to match their needs.
110107
# See ENTITIES_V2 above for all available v2 endpoints.
111-
DEFAULT_V2_RESOURCES = [
112-
"deals",
113-
"persons",
114-
"organizations",
115-
"products",
116-
"pipelines",
117-
"stages",
118-
]
108+
DEFAULT_V2_RESOURCES = ["deals", "persons", "organizations" ,"products", "pipelines", "stages"]

0 commit comments

Comments
 (0)