ingestr 0.13.25__py3-none-any.whl → 0.13.27__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.25"
1
+ version = "v0.13.27"
@@ -36,6 +36,7 @@ from .helpers import _get_property_names, fetch_data, fetch_property_history
36
36
  from .settings import (
37
37
  ALL,
38
38
  CRM_OBJECT_ENDPOINTS,
39
+ CRM_SCHEMAS_ENDPOINT,
39
40
  DEFAULT_COMPANY_PROPS,
40
41
  DEFAULT_CONTACT_PROPS,
41
42
  DEFAULT_DEAL_PROPS,
@@ -161,6 +162,13 @@ def hubspot(
161
162
  props,
162
163
  include_custom_props,
163
164
  )
165
+
166
+ @dlt.resource(name="schemas", write_disposition="merge", primary_key="id")
167
+ def schemas(
168
+ api_key: str = api_key,
169
+ ) -> Iterator[TDataItems]:
170
+ """Hubspot schemas resource"""
171
+ yield from fetch_data(CRM_SCHEMAS_ENDPOINT, api_key)
164
172
 
165
173
  @dlt.resource(name="quotes", write_disposition="replace")
166
174
  def quotes(
@@ -178,7 +186,7 @@ def hubspot(
178
186
  include_custom_props,
179
187
  )
180
188
 
181
- return companies, contacts, deals, tickets, products, quotes
189
+ return companies, contacts, deals, tickets, products, quotes, schemas
182
190
 
183
191
 
184
192
  def crm_objects(
@@ -132,16 +132,27 @@ def fetch_data(
132
132
  if "results" in _data:
133
133
  _objects: List[Dict[str, Any]] = []
134
134
  for _result in _data["results"]:
135
- _obj = _result.get("properties", _result)
136
- if "id" not in _obj and "id" in _result:
137
- # Move id from properties to top level
138
- _obj["id"] = _result["id"]
139
- if "associations" in _result:
140
- for association in _result["associations"]:
141
- __values = [
142
- {
143
- "value": _obj["hs_object_id"],
144
- f"{association}_id": __r["id"],
135
+ if endpoint == "/crm/v3/schemas":
136
+ _objects.append({
137
+ "name": _result["labels"].get("singular", ""),
138
+ "objectTypeId": _result.get("objectTypeId", ""),
139
+ "id": _result.get("id", ""),
140
+ "fullyQualifiedName": _result.get("fullyQualifiedName", ""),
141
+ "properties": _result.get("properties", ""),
142
+ "createdAt": _result.get("createdAt", ""),
143
+ "updatedAt": _result.get("updatedAt", "")
144
+ })
145
+ else:
146
+ _obj = _result.get("properties", _result)
147
+ if "id" not in _obj and "id" in _result:
148
+ # Move id from properties to top level
149
+ _obj["id"] = _result["id"]
150
+ if "associations" in _result:
151
+ for association in _result["associations"]:
152
+ __values = [
153
+ {
154
+ "value": _obj["hs_object_id"],
155
+ f"{association}_id": __r["id"],
145
156
  }
146
157
  for __r in _result["associations"][association]["results"]
147
158
  ]
@@ -152,7 +163,7 @@ def fetch_data(
152
163
  ]
153
164
 
154
165
  _obj[association] = __values
155
- _objects.append(_obj)
166
+ _objects.append(_obj)
156
167
  yield _objects
157
168
 
158
169
  # Follow pagination links if they exist
@@ -14,6 +14,7 @@ CRM_DEALS_ENDPOINT = "/crm/v3/objects/deals"
14
14
  CRM_PRODUCTS_ENDPOINT = "/crm/v3/objects/products"
15
15
  CRM_TICKETS_ENDPOINT = "/crm/v3/objects/tickets"
16
16
  CRM_QUOTES_ENDPOINT = "/crm/v3/objects/quotes"
17
+ CRM_SCHEMAS_ENDPOINT = "/crm/v3/schemas"
17
18
 
18
19
  CRM_OBJECT_ENDPOINTS = {
19
20
  "contact": CRM_CONTACTS_ENDPOINT,
ingestr/src/sources.py CHANGED
@@ -803,7 +803,7 @@ class HubspotSource:
803
803
  raise ValueError("api_key in the URI is required to connect to Hubspot")
804
804
 
805
805
  endpoint = None
806
- if table in ["contacts", "companies", "deals", "tickets", "products", "quotes"]:
806
+ if table in ["contacts", "companies", "deals", "tickets", "products", "quotes", "schemas"]:
807
807
  endpoint = table
808
808
  else:
809
809
  raise ValueError(
@@ -1398,13 +1398,19 @@ class GoogleAnalyticsSource:
1398
1398
  parse_uri = urlparse(uri)
1399
1399
  source_fields = parse_qs(parse_uri.query)
1400
1400
  cred_path = source_fields.get("credentials_path")
1401
+ cred_base64 = source_fields.get("credentials_base64")
1401
1402
 
1402
- if not cred_path:
1403
- raise ValueError("credentials_path is required to connect Google Analytics")
1404
- credentials = {}
1403
+ if not cred_path and not cred_base64:
1404
+ raise ValueError("credentials_path or credentials_base64 is required to connect Google Analytics")
1405
1405
 
1406
- with open(cred_path[0], "r") as f:
1407
- credentials = json.load(f)
1406
+ credentials = {}
1407
+ if cred_path:
1408
+ with open(cred_path[0], "r") as f:
1409
+ credentials = json.load(f)
1410
+ elif cred_base64:
1411
+ credentials = json.loads(
1412
+ base64.b64decode(cred_base64[0]).decode("utf-8")
1413
+ )
1408
1414
 
1409
1415
  property_id = source_fields.get("property_id")
1410
1416
  if not property_id:
@@ -2064,6 +2070,11 @@ class FrankfurterSource:
2064
2070
  end_date = pendulum.now()
2065
2071
  validate_dates(start_date=start_date, end_date=end_date)
2066
2072
 
2073
+ # For currencies and latest tables, set start and end dates to current date
2074
+ else:
2075
+ start_date = pendulum.now()
2076
+ end_date = pendulum.now()
2077
+
2067
2078
  # Validate table
2068
2079
  if table not in ["currencies", "latest", "exchange_rates"]:
2069
2080
  raise ValueError(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ingestr
3
- Version: 0.13.25
3
+ Version: 0.13.27
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.1.1
77
+ Requires-Dist: greenlet==3.2.0
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=wvbRCJ2--M0Zw2cYtSH874TxTtlD0wadHREeLG3anOY,25618
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=lkdWOsV5VTf0j0DW9a0BdkPbOZMZEYAUvs8aGZ2V-uE,21
5
+ ingestr/src/buildinfo.py,sha256=KAR_TXhR11JwQNb01TN64yrPzC6Xv6G-HVq71tG_n90,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
@@ -10,7 +10,7 @@ ingestr/src/filters.py,sha256=5LNpBgm8FJXdrFHGyM7dLVyphKykSpPk7yuQAZ8GML4,1133
10
10
  ingestr/src/loader.py,sha256=9NaWAyfkXdqAZSS-N72Iwo36Lbx4PyqIfaaH1dNdkFs,1712
11
11
  ingestr/src/partition.py,sha256=E0WHqh1FTheQAIVK_-jWUx0dgyYZCD1VxlAm362gao4,964
12
12
  ingestr/src/resource.py,sha256=XG-sbBapFVEM7OhHQFQRTdTLlh-mHB-N4V1t8F8Tsww,543
13
- ingestr/src/sources.py,sha256=u2Kh2K9v1YhrKXss9yGGxFXr-fMp1E6pvbcwjZqYiGM,73394
13
+ ingestr/src/sources.py,sha256=Zmjg3pDsCjSl8IG_bwH1eGiBxsrUMVesPLlYtz7YU-U,73859
14
14
  ingestr/src/table_definition.py,sha256=REbAbqdlmUMUuRh8nEQRreWjPVOQ5ZcfqGkScKdCrmk,390
15
15
  ingestr/src/time.py,sha256=H_Fk2J4ShXyUM-EMY7MqCLZQhlnZMZvO952bmZPc4yE,254
16
16
  ingestr/src/version.py,sha256=J_2xgZ0mKlvuHcjdKCx2nlioneLH0I47JiU_Slr_Nwc,189
@@ -61,9 +61,9 @@ 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=NYgSIAPXQh2Qp1eKun7TgcerKogq6pWtNkr-_f0FXbI,9464
65
- ingestr/src/hubspot/helpers.py,sha256=PTn-UHJv1ENIvA5azUTaHCmFXgmHLJC1tUatQ1N-KFE,6727
66
- ingestr/src/hubspot/settings.py,sha256=9P1OKiRL88kl_m8n1HhuG-Qpq9VGbqPLn5Q0QYneToU,2193
64
+ ingestr/src/hubspot/__init__.py,sha256=nHjMvqUAUNVy9dX-1YiaY6PeplDnzc_LjQl25DdVrYg,9765
65
+ ingestr/src/hubspot/helpers.py,sha256=vJPaF9qU71-w-LUe4NaRowioIJG3GfX4MObyitHJC6U,7388
66
+ ingestr/src/hubspot/settings.py,sha256=hXnIhE4_FlhtgUiCjMLGGZJ_lBlBQJ0YWi6lHJ6Q3WU,2234
67
67
  ingestr/src/kafka/__init__.py,sha256=wMCXdiraeKd1Kssi9WcVCGZaNGm2tJEtnNyuB4aR5_k,3541
68
68
  ingestr/src/kafka/helpers.py,sha256=V9WcVn3PKnEpggArHda4vnAcaV8VDuh__dSmRviJb5Y,7502
69
69
  ingestr/src/kinesis/__init__.py,sha256=u5ThH1y8uObZKXgIo71em1UnX6MsVHWOjcf1jKqKbE8,6205
@@ -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.25.dist-info/METADATA,sha256=IiZGRzg-cRXN10snt3Y_97yODJ9KkDF-x9XjP_cx9vo,13659
125
- ingestr-0.13.25.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
126
- ingestr-0.13.25.dist-info/entry_points.txt,sha256=oPJy0KBnPWYjDtP1k8qwAihcTLHSZokSQvRAw_wtfJM,46
127
- ingestr-0.13.25.dist-info/licenses/LICENSE.md,sha256=cW8wIhn8HFE-KLStDF9jHQ1O_ARWP3kTpk_-eOccL24,1075
128
- ingestr-0.13.25.dist-info/RECORD,,
124
+ ingestr-0.13.27.dist-info/METADATA,sha256=cq7IIe2m-ecKzlBDJVATmzn-t82fASfuQEgwHRf4v10,13659
125
+ ingestr-0.13.27.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
126
+ ingestr-0.13.27.dist-info/entry_points.txt,sha256=oPJy0KBnPWYjDtP1k8qwAihcTLHSZokSQvRAw_wtfJM,46
127
+ ingestr-0.13.27.dist-info/licenses/LICENSE.md,sha256=cW8wIhn8HFE-KLStDF9jHQ1O_ARWP3kTpk_-eOccL24,1075
128
+ ingestr-0.13.27.dist-info/RECORD,,