deriva 1.7.3__py3-none-any.whl → 1.7.5__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.
@@ -1,4 +1,4 @@
1
- import platform
1
+ import sys
2
2
  from deriva.core import get_credential, BaseCLI, DerivaServer, __version__
3
3
 
4
4
 
deriva/core/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "1.7.3"
1
+ __version__ = "1.7.5"
2
2
 
3
3
  from deriva.core.utils.core_utils import *
4
4
  from deriva.core.base_cli import BaseCLI, KeyValuePairArgs
deriva/core/datapath.py CHANGED
@@ -1008,35 +1008,32 @@ class _TableWrapper (object):
1008
1008
  # determine whether insert is idempotent and therefore retry safe
1009
1009
  retry_safe = on_conflict_skip and _has_user_pkey(self._wrapped_table)
1010
1010
 
1011
- # perform all requests in a helper we can hand to _ResultSet
1012
- def results_func(ignore1, ignore2, ignore3):
1013
- results = []
1014
- for batch in _generate_batches(
1015
- entities,
1016
- max_batch_rows=max_batch_rows,
1017
- max_batch_bytes=max_batch_bytes
1018
- ):
1019
- try:
1020
- if retry_safe:
1021
- resp = _request_with_retry(
1022
- lambda: request_func(batch),
1023
- retry_codes=retry_codes,
1024
- backoff_factor=backoff_factor,
1025
- max_attempts=max_attempts
1026
- )
1027
- else:
1028
- resp = request_func(batch)
1029
- results.extend(resp.json())
1030
- except HTTPError as e:
1031
- logger.debug(e.response.text)
1032
- if 400 <= e.response.status_code < 500:
1033
- raise DataPathException(_http_error_message(e), e)
1034
- else:
1035
- raise e
1036
- return results
1037
-
1038
- result = _ResultSet(self.path.uri, results_func)
1039
- result.fetch()
1011
+ # perform all requests synchronously so the caller can get exceptions
1012
+ results = []
1013
+ for batch in _generate_batches(
1014
+ entities,
1015
+ max_batch_rows=max_batch_rows,
1016
+ max_batch_bytes=max_batch_bytes
1017
+ ):
1018
+ try:
1019
+ if retry_safe:
1020
+ resp = _request_with_retry(
1021
+ lambda: request_func(batch),
1022
+ retry_codes=retry_codes,
1023
+ backoff_factor=backoff_factor,
1024
+ max_attempts=max_attempts
1025
+ )
1026
+ else:
1027
+ resp = request_func(batch)
1028
+ results.extend(resp.json())
1029
+ except HTTPError as e:
1030
+ logger.debug(e.response.text)
1031
+ if 400 <= e.response.status_code < 500:
1032
+ raise DataPathException(_http_error_message(e), e)
1033
+ else:
1034
+ raise e
1035
+
1036
+ result = _ResultSet(self.path.uri, lambda ignore1, ignore2, ignore3: results)
1040
1037
  return result
1041
1038
 
1042
1039
 
@@ -1101,34 +1098,37 @@ class _TableWrapper (object):
1101
1098
  def request_func(batch):
1102
1099
  return self._schema._catalog._wrapped_catalog.put(path, json=batch, headers={'Content-Type': 'application/json'})
1103
1100
 
1104
- # perform all requests in a helper we can hand to _ResultSet
1105
- def results_func(ignore1, ignore2, ignore3):
1106
- results = []
1107
- for batch in _generate_batches(
1108
- entities,
1109
- max_batch_rows=max_batch_rows,
1110
- max_batch_bytes=max_batch_bytes
1111
- ):
1112
- try:
1113
- resp = _request_with_retry(
1114
- lambda: request_func(batch),
1115
- retry_codes=retry_codes,
1116
- backoff_factor=backoff_factor,
1117
- max_attempts=max_attempts
1118
- )
1119
- results.extend(resp.json())
1120
- except HTTPError as e:
1121
- logger.debug(e.response.text)
1122
- if 400 <= e.response.status_code < 500:
1123
- raise DataPathException(_http_error_message(e), e)
1124
- else:
1125
- raise e
1126
- return results
1127
-
1128
- result = _ResultSet(self.path.uri, results_func)
1129
- result.fetch()
1101
+ # perform all requests synchronously so the caller can get exceptions
1102
+ results = []
1103
+ for batch in _generate_batches(
1104
+ entities,
1105
+ max_batch_rows=max_batch_rows,
1106
+ max_batch_bytes=max_batch_bytes
1107
+ ):
1108
+ try:
1109
+ resp = _request_with_retry(
1110
+ lambda: request_func(batch),
1111
+ retry_codes=retry_codes,
1112
+ backoff_factor=backoff_factor,
1113
+ max_attempts=max_attempts
1114
+ )
1115
+ results.extend(resp.json())
1116
+ except HTTPError as e:
1117
+ logger.debug(e.response.text)
1118
+ if 400 <= e.response.status_code < 500:
1119
+ raise DataPathException(_http_error_message(e), e)
1120
+ else:
1121
+ raise e
1122
+
1123
+ result = _ResultSet(self.path.uri, lambda ignore1, ignore2, ignore3: results)
1130
1124
  return result
1131
1125
 
1126
+ def delete(self):
1127
+ """Deletes the entity set referenced by the Table.
1128
+ """
1129
+ self.path.delete()
1130
+
1131
+
1132
1132
  class _TableAlias (_TableWrapper):
1133
1133
  """Represents a table alias in datapath expressions.
1134
1134
  """