hotglue-singer-sdk 1.0.4__py3-none-any.whl → 1.0.7__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.
@@ -74,6 +74,11 @@ class HotglueBaseSink(Rest):
74
74
 
75
75
  # remove failed records from the previous state so retrigger retries those records
76
76
  if self.previous_state:
77
+ if not self.previous_state.get("bookmarks"):
78
+ self.previous_state["bookmarks"] = {}
79
+ if not self.previous_state.get("summary"):
80
+ self.previous_state["summary"] = {}
81
+
77
82
  for stream in self.previous_state["bookmarks"]:
78
83
  self.previous_state["bookmarks"][stream] = [record for record in self.previous_state["bookmarks"][stream] if record.get("success") != False]
79
84
  for stream in self.previous_state["summary"]:
@@ -89,7 +94,7 @@ class HotglueBaseSink(Rest):
89
94
 
90
95
  # if previous state exists, add the hashes to the processed_hashes
91
96
  if self.previous_state:
92
- self.processed_hashes.extend([record["hash"] for record in self.previous_state["bookmarks"][self.name] if record.get("hash")])
97
+ self.processed_hashes.extend([record["hash"] for record in self.previous_state.get("bookmarks", {}).get(self.name, []) if record.get("hash")])
93
98
 
94
99
  # get the full target state
95
100
  target_state = self._target._latest_state
@@ -174,6 +179,14 @@ class HotglueSink(HotglueBaseSink, RecordSink):
174
179
  def preprocess_record(self, record: dict, context: dict) -> dict:
175
180
  raise NotImplementedError()
176
181
 
182
+
183
+ def _get_error_classification_metadata(self, error: Exception) -> dict:
184
+ if isinstance(error, (InvalidCredentialsError)):
185
+ return {"hg_error_class": InvalidCredentialsError.__name__}
186
+ elif isinstance(error, (InvalidPayloadError)):
187
+ return {"hg_error_class": InvalidPayloadError.__name__}
188
+ return {}
189
+
177
190
  def process_record(self, record: dict, context: dict) -> None:
178
191
  """Process the record."""
179
192
  if not self.latest_state:
@@ -197,8 +210,7 @@ class HotglueSink(HotglueBaseSink, RecordSink):
197
210
  success = False
198
211
  self.logger.exception(f"Preprocess record error {str(e)}")
199
212
  state_updates['error'] = str(e)
200
- if isinstance(e, (InvalidCredentialsError, InvalidPayloadError)):
201
- state_updates['hg_error_class'] = e.__class__.__name__
213
+ state_updates.update(self._get_error_classification_metadata(e))
202
214
 
203
215
  if success is not False:
204
216
 
@@ -226,8 +238,8 @@ class HotglueSink(HotglueBaseSink, RecordSink):
226
238
  except Exception as e:
227
239
  self.logger.exception(f"Upsert record error {str(e)}")
228
240
  state_updates['error'] = str(e)
229
- if isinstance(e, (InvalidCredentialsError, InvalidPayloadError)):
230
- state_updates['hg_error_class'] = e.__class__.__name__
241
+ success = False
242
+ state_updates.update(self._get_error_classification_metadata(e))
231
243
 
232
244
 
233
245
  if success:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hotglue-singer-sdk
3
- Version: 1.0.4
3
+ Version: 1.0.7
4
4
  Summary: A framework for building Singer taps and targets
5
5
  License: Apache 2.0
6
6
  License-File: LICENSE
@@ -38,7 +38,7 @@ hotglue_singer_sdk/tap_base.py,sha256=7lRZt40GzsMOeMlpoivxaG1Jjs5yB8JeR66JZhrLqe
38
38
  hotglue_singer_sdk/target_base.py,sha256=QbBVXr6x5G3bgbPwpMG80ttL0TMOK8bjJCbJsa4AOFw,19130
39
39
  hotglue_singer_sdk/target_sdk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
40
  hotglue_singer_sdk/target_sdk/auth.py,sha256=jU3yL5mtlf8p2VWsfoR_TaMjp8_APpQNPtPgHRIUIBc,3925
41
- hotglue_singer_sdk/target_sdk/client.py,sha256=9SZL-rLvFlAmZyStuMzjjwXnPauvJ8RxtCNg25kXeqY,10529
41
+ hotglue_singer_sdk/target_sdk/client.py,sha256=fVQVFHtmKn4W2KOALI9XIreX6IY1ji2JeI5lwEiI-jY,10996
42
42
  hotglue_singer_sdk/target_sdk/common.py,sha256=l2ldX1qXxbzvjeaicu0If0CUMV_bmX2OV5NSFMol_fM,333
43
43
  hotglue_singer_sdk/target_sdk/lambda.py,sha256=LyYFS39r0zmCBbUEEwcueLOWI2L2YiKlfob8-dU9jMs,3685
44
44
  hotglue_singer_sdk/target_sdk/rest.py,sha256=3PUOx7pWg7DfbMonu2wiiQqU5mcN49B-_1mvQVgL4Gc,3607
@@ -47,7 +47,7 @@ hotglue_singer_sdk/target_sdk/target.py,sha256=uVqmXmyIO-h3M8VCiZ1McPXczZj7EU0PO
47
47
  hotglue_singer_sdk/target_sdk/target_base.py,sha256=LyQQndYGlzu5LcIj-MMcmcjdGAmAYVgvdNAxvCgFpvk,22022
48
48
  hotglue_singer_sdk/testing.py,sha256=BifsP9X83pgKdfynI5CComchoRWEHpe81h-UfOwK_G0,5860
49
49
  hotglue_singer_sdk/typing.py,sha256=jTGFhON9uBZe9e0vHH6-6rjeD2YrpzolPiYigIuo7zU,16186
50
- hotglue_singer_sdk-1.0.4.dist-info/METADATA,sha256=Pscfl0Ojzj1ST8rmlNRSV1SmanH9URKmuUWq-0Bl95M,2376
51
- hotglue_singer_sdk-1.0.4.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
52
- hotglue_singer_sdk-1.0.4.dist-info/licenses/LICENSE,sha256=BGsDEGu628ZSlSfJzr3RshF0_KTW-E1Z--XnqjioYWg,11337
53
- hotglue_singer_sdk-1.0.4.dist-info/RECORD,,
50
+ hotglue_singer_sdk-1.0.7.dist-info/METADATA,sha256=qOmHWsMv3_4SEfAftosgA6zIyOLiI1Ki22EQx_4emuU,2376
51
+ hotglue_singer_sdk-1.0.7.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
52
+ hotglue_singer_sdk-1.0.7.dist-info/licenses/LICENSE,sha256=BGsDEGu628ZSlSfJzr3RshF0_KTW-E1Z--XnqjioYWg,11337
53
+ hotglue_singer_sdk-1.0.7.dist-info/RECORD,,