ingestr 0.13.30__py3-none-any.whl → 0.13.31__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ingestr might be problematic. Click here for more details.

ingestr/src/buildinfo.py CHANGED
@@ -1 +1 @@
1
- version = "v0.13.30"
1
+ version = "v0.13.31"
@@ -32,7 +32,12 @@ from dlt.common import pendulum
32
32
  from dlt.common.typing import TDataItems
33
33
  from dlt.sources import DltResource
34
34
 
35
- from .helpers import _get_property_names, fetch_data, fetch_property_history
35
+ from .helpers import (
36
+ _get_property_names,
37
+ fetch_data,
38
+ fetch_data_raw,
39
+ fetch_property_history,
40
+ )
36
41
  from .settings import (
37
42
  ALL,
38
43
  CRM_OBJECT_ENDPOINTS,
@@ -192,12 +197,21 @@ def hubspot(
192
197
  api_key: str = api_key,
193
198
  custom_object_name: str = custom_object,
194
199
  ) -> Iterator[TDataItems]:
195
- get_custom_object = schemas(api_key)
200
+ get_custom_object = fetch_data_raw(CRM_SCHEMAS_ENDPOINT, api_key)
196
201
  object_type_id = None
197
- for custom_object in get_custom_object:
198
- if custom_object["name"] == custom_object_name.capitalize():
202
+
203
+ custom_object_lowercase = custom_object_name.lower()
204
+ for custom_object in get_custom_object["results"]:
205
+ if custom_object["name"].lower() == custom_object_lowercase:
199
206
  object_type_id = custom_object["objectTypeId"]
200
207
  break
208
+
209
+ # sometimes people use the plural name of the object type by accident, we should try to match that if we can
210
+ if "labels" in custom_object:
211
+ if custom_object_lowercase == custom_object["labels"]["plural"].lower():
212
+ object_type_id = custom_object["objectTypeId"]
213
+ break
214
+
201
215
  if object_type_id is None:
202
216
  raise ValueError(f"There is no such custom object as {custom_object_name}")
203
217
  custom_object_properties = f"crm/v3/properties/{object_type_id}"
@@ -130,6 +130,7 @@ def fetch_data(
130
130
  # Parse the API response and yield the properties of each result
131
131
  # Parse the response JSON data
132
132
  _data = r.json()
133
+
133
134
  # Yield the properties of each result in the API response
134
135
  while _data is not None:
135
136
  if "results" in _data:
@@ -156,6 +157,7 @@ def fetch_data(
156
157
  if "id" not in _obj and "id" in _result:
157
158
  # Move id from properties to top level
158
159
  _obj["id"] = _result["id"]
160
+
159
161
  if "associations" in _result:
160
162
  for association in _result["associations"]:
161
163
  __values = [
@@ -168,12 +170,13 @@ def fetch_data(
168
170
  ]
169
171
  ]
170
172
 
171
- # remove duplicates from list of dicts
172
- __values = [
173
- dict(t) for t in {tuple(d.items()) for d in __values}
174
- ]
173
+ # remove duplicates from list of dicts
174
+ __values = [
175
+ dict(t) for t in {tuple(d.items()) for d in __values}
176
+ ]
177
+
178
+ _obj[association] = __values
175
179
 
176
- _obj[association] = __values
177
180
  _objects.append(_obj)
178
181
  yield _objects
179
182
 
@@ -208,3 +211,12 @@ def _get_property_names(api_key: str, object_type: str) -> List[str]:
208
211
  properties.extend([prop["name"] for prop in page])
209
212
 
210
213
  return properties
214
+
215
+
216
+ def fetch_data_raw(
217
+ endpoint: str, api_key: str, params: Optional[Dict[str, Any]] = None
218
+ ) -> Iterator[List[Dict[str, Any]]]:
219
+ url = get_url(endpoint)
220
+ headers = _get_headers(api_key)
221
+ r = requests.get(url, headers=headers, params=params)
222
+ return r.json()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ingestr
3
- Version: 0.13.30
3
+ Version: 0.13.31
4
4
  Summary: ingestr is a command-line application that ingests data from various sources and stores them in any database.
5
5
  Project-URL: Homepage, https://github.com/bruin-data/ingestr
6
6
  Project-URL: Issues, https://github.com/bruin-data/ingestr/issues
@@ -74,7 +74,7 @@ Requires-Dist: google-cloud-storage==3.1.0
74
74
  Requires-Dist: google-crc32c==1.6.0
75
75
  Requires-Dist: google-resumable-media==2.7.2
76
76
  Requires-Dist: googleapis-common-protos==1.69.0
77
- Requires-Dist: greenlet==3.2.0
77
+ Requires-Dist: greenlet==3.2.1
78
78
  Requires-Dist: grpcio-status==1.62.3
79
79
  Requires-Dist: grpcio==1.70.0
80
80
  Requires-Dist: hdbcli==2.23.27
@@ -2,7 +2,7 @@ ingestr/conftest.py,sha256=Q03FIJIZpLBbpj55cfCHIKEjc1FCvWJhMF2cidUJKQU,1748
2
2
  ingestr/main.py,sha256=Vt5NFN59BUlkYrOwiF9xF5MCFYp9r-aVSnQ99f1ypRE,25964
3
3
  ingestr/src/.gitignore,sha256=8cX1AZTSI0TcdZFGTmS_oyBjpfCzhOEt0DdAo2dFIY8,203
4
4
  ingestr/src/blob.py,sha256=onMe5ZHxPXTdcB_s2oGNdMo-XQJ3ajwOsWE9eSTGFmc,1495
5
- ingestr/src/buildinfo.py,sha256=4uN8Z1CmXZ2T6X2YHEC3ZWFuS5uL_sTMUZiwgVyotHo,21
5
+ ingestr/src/buildinfo.py,sha256=b5zsXj7M33l1DC6hlhdWhnmeLEBJhFFtKbG2j0gA0ZM,21
6
6
  ingestr/src/destinations.py,sha256=vrGij4qMPCdXTMIimROWBJFqzOqCM4DFmgyubgSHejA,11279
7
7
  ingestr/src/errors.py,sha256=Ufs4_DfE77_E3vnA1fOQdi6cmuLVNm7_SbFLkL1XPGk,686
8
8
  ingestr/src/factory.py,sha256=659h_sVRBhtPv2dvtOK8tf3PtUhlK3KsWLrb20_iQKw,5333
@@ -61,8 +61,8 @@ ingestr/src/google_sheets/helpers/api_calls.py,sha256=RiVfdacbaneszhmuhYilkJnkc9
61
61
  ingestr/src/google_sheets/helpers/data_processing.py,sha256=RNt2MYfdJhk4bRahnQVezpNg2x9z0vx60YFq2ukZ8vI,11004
62
62
  ingestr/src/gorgias/__init__.py,sha256=_mFkMYwlY5OKEY0o_FK1OKol03A-8uk7bm1cKlmt5cs,21432
63
63
  ingestr/src/gorgias/helpers.py,sha256=DamuijnvhGY9hysQO4txrVMf4izkGbh5qfBKImdOINE,5427
64
- ingestr/src/hubspot/__init__.py,sha256=rSYmN8h6qqxhWCW6elD-pC7iqHXlIofb1F9wvTzziUE,10962
65
- ingestr/src/hubspot/helpers.py,sha256=fscilfO_K7HS2XQxzf7MeZwVXLTP0WdqnV-NhdeqQAA,7748
64
+ ingestr/src/hubspot/__init__.py,sha256=QheZb_F2TEBdzd29SEgkU3AMdIIF7Gpj-t27EXnSIZ4,11448
65
+ ingestr/src/hubspot/helpers.py,sha256=4aVOSzIsQV3RemqRJEJLu7BWMdcOuubwNvrjuMu87rg,8045
66
66
  ingestr/src/hubspot/settings.py,sha256=i73MkSiJfRLMFLfiJgYdhp-rhymHTfoqFzZ4uOJdFJM,2456
67
67
  ingestr/src/kafka/__init__.py,sha256=wMCXdiraeKd1Kssi9WcVCGZaNGm2tJEtnNyuB4aR5_k,3541
68
68
  ingestr/src/kafka/helpers.py,sha256=V9WcVn3PKnEpggArHda4vnAcaV8VDuh__dSmRviJb5Y,7502
@@ -121,8 +121,8 @@ ingestr/testdata/delete_insert_part2.csv,sha256=B_KUzpzbNdDY_n7wWop1mT2cz36TmayS
121
121
  ingestr/testdata/merge_expected.csv,sha256=DReHqWGnQMsf2PBv_Q2pfjsgvikYFnf1zYcQZ7ZqYN0,276
122
122
  ingestr/testdata/merge_part1.csv,sha256=Pw8Z9IDKcNU0qQHx1z6BUf4rF_-SxKGFOvymCt4OY9I,185
123
123
  ingestr/testdata/merge_part2.csv,sha256=T_GiWxA81SN63_tMOIuemcvboEFeAmbKc7xRXvL9esw,287
124
- ingestr-0.13.30.dist-info/METADATA,sha256=h7uzURTF300XZEFjInqhpEjO6b-RFeBHWgS5jf4qCM0,13659
125
- ingestr-0.13.30.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
126
- ingestr-0.13.30.dist-info/entry_points.txt,sha256=oPJy0KBnPWYjDtP1k8qwAihcTLHSZokSQvRAw_wtfJM,46
127
- ingestr-0.13.30.dist-info/licenses/LICENSE.md,sha256=cW8wIhn8HFE-KLStDF9jHQ1O_ARWP3kTpk_-eOccL24,1075
128
- ingestr-0.13.30.dist-info/RECORD,,
124
+ ingestr-0.13.31.dist-info/METADATA,sha256=tYd7c8Yc5Zqv0vDeKd4haCgBnl8PfvpLKaHToxHF5vs,13659
125
+ ingestr-0.13.31.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
126
+ ingestr-0.13.31.dist-info/entry_points.txt,sha256=oPJy0KBnPWYjDtP1k8qwAihcTLHSZokSQvRAw_wtfJM,46
127
+ ingestr-0.13.31.dist-info/licenses/LICENSE.md,sha256=cW8wIhn8HFE-KLStDF9jHQ1O_ARWP3kTpk_-eOccL24,1075
128
+ ingestr-0.13.31.dist-info/RECORD,,