vastdb 0.0.5.7__py3-none-any.whl → 0.0.5.8__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.
@@ -60,7 +60,14 @@ class ObjectDetails(object):
60
60
  return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
61
61
  return 0
62
62
 
63
- def Start(builder): builder.StartObject(5)
63
+ # ObjectDetails
64
+ def NumPartitions(self):
65
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
66
+ if o != 0:
67
+ return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
68
+ return 0
69
+
70
+ def Start(builder): builder.StartObject(6)
64
71
  def ObjectDetailsStart(builder):
65
72
  """This method is deprecated. Please switch to Start."""
66
73
  return Start(builder)
@@ -84,6 +91,10 @@ def AddSizeInBytes(builder, sizeInBytes): builder.PrependUint64Slot(4, sizeInByt
84
91
  def ObjectDetailsAddSizeInBytes(builder, sizeInBytes):
85
92
  """This method is deprecated. Please switch to AddSizeInBytes."""
86
93
  return AddSizeInBytes(builder, sizeInBytes)
94
+ def AddNumPartitions(builder, numPartitions): builder.PrependUint64Slot(5, numPartitions, 0)
95
+ def ObjectDetailsAddNumPartitions(builder, numPartitions):
96
+ """This method is deprecated. Please switch to AddNumPartitions."""
97
+ return AddNumPartitions(builder, numPartitions)
87
98
  def End(builder): return builder.EndObject()
88
99
  def ObjectDetailsEnd(builder):
89
100
  """This method is deprecated. Please switch to End."""
vastdb/api.py CHANGED
@@ -681,16 +681,33 @@ def _iter_nested_arrays(column: pa.Array) -> Iterator[pa.Array]:
681
681
  elif isinstance(column.type, pa.ListType):
682
682
  yield from _iter_nested_arrays(column.values) # Note: Map is serialized in VAST as a List<Struct<K, V>>
683
683
 
684
+ def _encode_table_props(**kwargs):
685
+ if all([v is None for v in kwargs.values()]):
686
+ return None
687
+ else:
688
+ return "$".join([f"{k}={v}" for k, v in kwargs.items()])
689
+
690
+
691
+ def _decode_table_props(s):
692
+ if s.strip() == '':
693
+ return {}
694
+ else:
695
+ return {x[0]: int(x[1]) for x in [y.split('=') for y in s.strip().split("$")]}
684
696
 
685
- TableInfo = namedtuple('table_info', 'name properties handle num_rows size_in_bytes')
686
- def _parse_table_info(obj):
687
697
 
698
+ TableInfo = namedtuple('table_info', 'name properties handle num_rows size_in_bytes num_partitions')
699
+
700
+
701
+ def _parse_table_info(obj):
688
702
  name = obj.Name().decode()
689
703
  properties = obj.Properties().decode()
690
704
  handle = obj.Handle().decode()
691
705
  num_rows = obj.NumRows()
692
706
  used_bytes = obj.SizeInBytes()
693
- return TableInfo(name, properties, handle, num_rows, used_bytes)
707
+ num_partitions = obj.NumPartitions()
708
+ if num_partitions != 0:
709
+ properties = _decode_table_props(properties)
710
+ return TableInfo(name, properties, handle, num_rows, used_bytes, num_partitions)
694
711
 
695
712
  def build_record_batch(column_info, column_values):
696
713
  _logger.info(f"column_info={column_info}")
@@ -974,13 +991,6 @@ class VastdbApi:
974
991
 
975
992
  return snapshots, is_truncated, marker
976
993
 
977
- @staticmethod
978
- def encode_table_props(**kwargs):
979
- if all(v is None for v in kwargs.values()):
980
- return None
981
- else:
982
- return "$".join([f"{k}={v}" for k, v in kwargs.items()])
983
-
984
994
  def create_table(self, bucket, schema, name, arrow_schema, txid=0, client_tags=[], expected_retvals=[],
985
995
  topic_partitions=0, create_imports_table=False, use_external_row_ids_allocation=False,
986
996
  src_timestamp=None, retention_in_mins=None, past_threshold_ts=None, future_threshold_ts=None):
@@ -1006,7 +1016,7 @@ class VastdbApi:
1006
1016
  url_params = {'topic_partitions': str(topic_partitions)} if topic_partitions else {}
1007
1017
 
1008
1018
  if topic_partitions > 0:
1009
- table_props = self.encode_table_props(src_timestamp=src_timestamp, retention_in_mins=retention_in_mins, past_threshold_ts=past_threshold_ts, future_threshold_ts=future_threshold_ts)
1019
+ table_props = _encode_table_props(src_timestamp=src_timestamp, retention_in_mins=retention_in_mins, past_threshold_ts=past_threshold_ts, future_threshold_ts=future_threshold_ts)
1010
1020
  if table_props is not None:
1011
1021
  url_params['table-props'] = table_props
1012
1022
 
@@ -1075,7 +1085,7 @@ class VastdbApi:
1075
1085
  builder = flatbuffers.Builder(1024)
1076
1086
 
1077
1087
  if src_timestamp is not None or retention_in_mins is not None or past_threshold_ts is not None or future_threshold_ts is not None:
1078
- table_properties = self.encode_table_props(src_timestamp=src_timestamp, retention_in_mins=retention_in_mins, past_threshold_ts=past_threshold_ts, future_threshold_ts=future_threshold_ts)
1088
+ table_properties = _encode_table_props(src_timestamp=src_timestamp, retention_in_mins=retention_in_mins, past_threshold_ts=past_threshold_ts, future_threshold_ts=future_threshold_ts)
1079
1089
  if table_properties is None:
1080
1090
  table_properties = ""
1081
1091
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vastdb
3
- Version: 0.0.5.7
3
+ Version: 0.0.5.8
4
4
  Summary: VAST Data SDK
5
5
  Home-page: https://github.com/vast-data/vastdb_sdk
6
6
  Author: VAST DATA
@@ -144,13 +144,13 @@ vast_flatbuf/tabular/ImportDataRequest.py,sha256=f1chKp5d5NUxfNjI8YI1o4MYInF8UDh
144
144
  vast_flatbuf/tabular/ListProjectionsResponse.py,sha256=secqrBsJY3ydbA28j09rmxzBqj-c1JNqaP7JMuib7nE,4240
145
145
  vast_flatbuf/tabular/ListSchemasResponse.py,sha256=V8tbwcWAC96eNwuoqDNqCSb02BnMdq60TpyISuWTVMk,3036
146
146
  vast_flatbuf/tabular/ListTablesResponse.py,sha256=V7jZAS8ryKY8s6o_QyjWzgan-rsGm17zjKEmi7K6qTM,3550
147
- vast_flatbuf/tabular/ObjectDetails.py,sha256=qW0WtbkCYYE_L-Kw6VNRDCLYaRm5lKvTbLNkfD4zV4A,3589
147
+ vast_flatbuf/tabular/ObjectDetails.py,sha256=5mMZ0iL_iC1cztyyjPeEeJv3ch6Nk1zyCOce0AY601s,4122
148
148
  vast_flatbuf/tabular/S3File.py,sha256=KC9c2oS5-JXwTTriUVFdjOvRG0B54Cq9kviSDZY3NI0,4450
149
149
  vast_flatbuf/tabular/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
150
150
  vastdb/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
151
- vastdb/api.py,sha256=NgXpHkclN6mV1uR3Jl7ksIFbODE8MF9JVMws_GPious,126722
152
- vastdb-0.0.5.7.dist-info/LICENSE,sha256=obffan7LYrq7hLHNrY7vHcn2pKUTBUYXMKu-VOAvDxU,11333
153
- vastdb-0.0.5.7.dist-info/METADATA,sha256=qEXKBdRpLG4juHrG7NwyAmmwv1YxLX4zEcrIesJi_tE,1349
154
- vastdb-0.0.5.7.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
155
- vastdb-0.0.5.7.dist-info/top_level.txt,sha256=Vsj2MKtlhPg0J4so64slQtnwjhgoPmJgcG-6YcVAwVc,20
156
- vastdb-0.0.5.7.dist-info/RECORD,,
151
+ vastdb/api.py,sha256=gRpHYnK_opRwBK6rwhmmsOHJHsJixK9E8y_qQOJWcuM,127002
152
+ vastdb-0.0.5.8.dist-info/LICENSE,sha256=obffan7LYrq7hLHNrY7vHcn2pKUTBUYXMKu-VOAvDxU,11333
153
+ vastdb-0.0.5.8.dist-info/METADATA,sha256=LerbRKsB2CXunpnaNtHp7B1mpWB2xVwnopLe8jbNvgM,1349
154
+ vastdb-0.0.5.8.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
155
+ vastdb-0.0.5.8.dist-info/top_level.txt,sha256=Vsj2MKtlhPg0J4so64slQtnwjhgoPmJgcG-6YcVAwVc,20
156
+ vastdb-0.0.5.8.dist-info/RECORD,,