vastdb 1.3.4__py3-none-any.whl → 1.3.6__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.
- vastdb/_internal.py +73 -18
- vastdb/bucket.py +1 -1
- vastdb/schema.py +5 -2
- vastdb/table.py +8 -5
- {vastdb-1.3.4.dist-info → vastdb-1.3.6.dist-info}/METADATA +1 -1
- {vastdb-1.3.4.dist-info → vastdb-1.3.6.dist-info}/RECORD +9 -9
- {vastdb-1.3.4.dist-info → vastdb-1.3.6.dist-info}/LICENSE +0 -0
- {vastdb-1.3.4.dist-info → vastdb-1.3.6.dist-info}/WHEEL +0 -0
- {vastdb-1.3.4.dist-info → vastdb-1.3.6.dist-info}/top_level.txt +0 -0
vastdb/_internal.py
CHANGED
|
@@ -119,6 +119,8 @@ TABULAR_INVALID_ROW_ID = 0xFFFFFFFFFFFF # (1<<48)-1
|
|
|
119
119
|
ESTORE_INVALID_EHANDLE = UINT64_MAX
|
|
120
120
|
IMPORTED_OBJECTS_TABLE_NAME = "vastdb-imported-objects"
|
|
121
121
|
|
|
122
|
+
KAFKA_TOPICS_SCHEMA_NAME = 'kafka_topics'
|
|
123
|
+
|
|
122
124
|
"""
|
|
123
125
|
S3 Tabular API
|
|
124
126
|
"""
|
|
@@ -787,15 +789,14 @@ def _decode_table_props(s):
|
|
|
787
789
|
TableInfo = namedtuple('TableInfo', 'name properties handle num_rows size_in_bytes num_partitions')
|
|
788
790
|
|
|
789
791
|
|
|
790
|
-
def _parse_table_info(obj):
|
|
792
|
+
def _parse_table_info(obj, parse_properties):
|
|
791
793
|
name = obj.Name().decode()
|
|
792
794
|
properties = obj.Properties().decode()
|
|
793
795
|
handle = obj.Handle().decode()
|
|
794
796
|
num_rows = obj.NumRows()
|
|
795
797
|
used_bytes = obj.SizeInBytes()
|
|
796
798
|
num_partitions = obj.NumPartitions()
|
|
797
|
-
|
|
798
|
-
properties = _decode_table_props(properties)
|
|
799
|
+
properties = parse_properties(properties)
|
|
799
800
|
return TableInfo(name, properties, handle, num_rows, used_bytes, num_partitions)
|
|
800
801
|
|
|
801
802
|
|
|
@@ -1109,9 +1110,29 @@ class VastdbApi:
|
|
|
1109
1110
|
|
|
1110
1111
|
return snapshots, is_truncated, marker
|
|
1111
1112
|
|
|
1112
|
-
def create_table(self, bucket, schema, name, arrow_schema=None,
|
|
1113
|
-
|
|
1114
|
-
|
|
1113
|
+
def create_table(self, bucket, schema, name, arrow_schema=None,
|
|
1114
|
+
txid=0, client_tags=[], expected_retvals=[],
|
|
1115
|
+
create_imports_table=False, use_external_row_ids_allocation=False, table_props=None):
|
|
1116
|
+
self._create_table_internal(bucket=bucket, schema=schema, name=name, arrow_schema=arrow_schema,
|
|
1117
|
+
txid=txid, client_tags=client_tags, expected_retvals=expected_retvals,
|
|
1118
|
+
create_imports_table=create_imports_table, use_external_row_ids_allocation=use_external_row_ids_allocation,
|
|
1119
|
+
table_props=table_props)
|
|
1120
|
+
|
|
1121
|
+
def create_topic(self, bucket, name, topic_partitions, expected_retvals=[],
|
|
1122
|
+
message_timestamp_type=None, retention_ms=None, message_timestamp_after_max_ms=None,
|
|
1123
|
+
message_timestamp_before_max_ms=None):
|
|
1124
|
+
table_props = _encode_table_props(message_timestamp_type=message_timestamp_type,
|
|
1125
|
+
retention_ms=retention_ms,
|
|
1126
|
+
message_timestamp_after_max_ms=message_timestamp_after_max_ms,
|
|
1127
|
+
message_timestamp_before_max_ms=message_timestamp_before_max_ms)
|
|
1128
|
+
|
|
1129
|
+
self._create_table_internal(bucket=bucket, schema=KAFKA_TOPICS_SCHEMA_NAME, name=name, arrow_schema=None,
|
|
1130
|
+
expected_retvals=expected_retvals, topic_partitions=topic_partitions,
|
|
1131
|
+
table_props=table_props)
|
|
1132
|
+
|
|
1133
|
+
def _create_table_internal(self, bucket, schema, name, arrow_schema=None,
|
|
1134
|
+
txid=0, client_tags=[], expected_retvals=[], topic_partitions=0,
|
|
1135
|
+
create_imports_table=False, use_external_row_ids_allocation=False, table_props=None):
|
|
1115
1136
|
"""
|
|
1116
1137
|
Create a table, use the following request
|
|
1117
1138
|
POST /bucket/schema/table?table HTTP/1.1
|
|
@@ -1142,16 +1163,17 @@ class VastdbApi:
|
|
|
1142
1163
|
if create_imports_table:
|
|
1143
1164
|
url_params['sub-table'] = IMPORTED_OBJECTS_TABLE_NAME
|
|
1144
1165
|
|
|
1145
|
-
if
|
|
1146
|
-
|
|
1147
|
-
if table_props is not None:
|
|
1148
|
-
url_params['table-props'] = table_props
|
|
1166
|
+
if table_props is not None:
|
|
1167
|
+
url_params['table-props'] = table_props
|
|
1149
1168
|
|
|
1150
1169
|
self._request(
|
|
1151
1170
|
method="POST",
|
|
1152
1171
|
url=self._url(bucket=bucket, schema=schema, table=name, command="table", url_params=url_params),
|
|
1153
1172
|
data=serialized_schema, headers=headers)
|
|
1154
1173
|
|
|
1174
|
+
def get_topic_stats(self, bucket, name, expected_retvals=[]):
|
|
1175
|
+
return self.get_table_stats(bucket=bucket, schema=KAFKA_TOPICS_SCHEMA_NAME, name=name, expected_retvals=expected_retvals)
|
|
1176
|
+
|
|
1155
1177
|
def get_table_stats(self, bucket, schema, name, txid=0, client_tags=[], expected_retvals=[], imports_table_stats=False):
|
|
1156
1178
|
"""
|
|
1157
1179
|
GET /mybucket/myschema/mytable?stats HTTP/1.1
|
|
@@ -1174,9 +1196,22 @@ class VastdbApi:
|
|
|
1174
1196
|
endpoints = [self.url] # we cannot replace the host by a VIP address in HTTPS-based URLs
|
|
1175
1197
|
return TableStatsResult(num_rows, size_in_bytes, is_external_rowid_alloc, tuple(endpoints))
|
|
1176
1198
|
|
|
1177
|
-
def
|
|
1199
|
+
def alter_topic(self, bucket, name,
|
|
1178
1200
|
new_name="", expected_retvals=[],
|
|
1179
|
-
message_timestamp_type=None, retention_ms=None, message_timestamp_after_max_ms=None,
|
|
1201
|
+
message_timestamp_type=None, retention_ms=None, message_timestamp_after_max_ms=None,
|
|
1202
|
+
message_timestamp_before_max_ms=None):
|
|
1203
|
+
table_properties = _encode_table_props(message_timestamp_type=message_timestamp_type,
|
|
1204
|
+
retention_ms=retention_ms,
|
|
1205
|
+
message_timestamp_after_max_ms=message_timestamp_after_max_ms,
|
|
1206
|
+
message_timestamp_before_max_ms=message_timestamp_before_max_ms)
|
|
1207
|
+
if table_properties is None:
|
|
1208
|
+
table_properties = ""
|
|
1209
|
+
|
|
1210
|
+
self.alter_table(bucket=bucket, schema=KAFKA_TOPICS_SCHEMA_NAME, name=name,
|
|
1211
|
+
table_properties=table_properties, new_name=new_name, expected_retvals=expected_retvals)
|
|
1212
|
+
|
|
1213
|
+
def alter_table(self, bucket, schema, name, txid=0, client_tags=[], table_properties="",
|
|
1214
|
+
new_name="", expected_retvals=[]):
|
|
1180
1215
|
"""
|
|
1181
1216
|
PUT /mybucket/myschema/mytable?table HTTP/1.1
|
|
1182
1217
|
Content-Length: ContentLength
|
|
@@ -1188,10 +1223,8 @@ class VastdbApi:
|
|
|
1188
1223
|
"""
|
|
1189
1224
|
builder = flatbuffers.Builder(1024)
|
|
1190
1225
|
|
|
1191
|
-
if
|
|
1192
|
-
table_properties =
|
|
1193
|
-
if table_properties is None:
|
|
1194
|
-
table_properties = ""
|
|
1226
|
+
if table_properties is None:
|
|
1227
|
+
table_properties = ""
|
|
1195
1228
|
|
|
1196
1229
|
properties = builder.CreateString(table_properties)
|
|
1197
1230
|
tabular_alter_table.Start(builder)
|
|
@@ -1211,6 +1244,10 @@ class VastdbApi:
|
|
|
1211
1244
|
url=self._url(bucket=bucket, schema=schema, table=name, command="table", url_params=url_params),
|
|
1212
1245
|
data=alter_table_req, headers=headers)
|
|
1213
1246
|
|
|
1247
|
+
def drop_topic(self, bucket, name, expected_retvals=[]):
|
|
1248
|
+
self.drop_table(bucket=bucket, schema=KAFKA_TOPICS_SCHEMA_NAME, name=name,
|
|
1249
|
+
expected_retvals=expected_retvals)
|
|
1250
|
+
|
|
1214
1251
|
def drop_table(self, bucket, schema, name, txid=0, client_tags=[], expected_retvals=[], remove_imports_table=False):
|
|
1215
1252
|
"""
|
|
1216
1253
|
DELETE /mybucket/schema_path/mytable?table HTTP/1.1
|
|
@@ -1227,8 +1264,26 @@ class VastdbApi:
|
|
|
1227
1264
|
url=self._url(bucket=bucket, schema=schema, table=name, command="table", url_params=url_params),
|
|
1228
1265
|
headers=headers)
|
|
1229
1266
|
|
|
1267
|
+
def list_topics(self, bucket, max_keys=1000, next_key=0, name_prefix="",
|
|
1268
|
+
exact_match=False, expected_retvals=[], include_list_stats=False, count_only=False):
|
|
1269
|
+
return self._list_tables_internal(bucket=bucket, schema=KAFKA_TOPICS_SCHEMA_NAME,
|
|
1270
|
+
parse_properties=_decode_table_props, max_keys=max_keys,
|
|
1271
|
+
next_key=next_key, name_prefix=name_prefix, exact_match=exact_match,
|
|
1272
|
+
expected_retvals=expected_retvals,
|
|
1273
|
+
include_list_stats=include_list_stats, count_only=count_only)
|
|
1274
|
+
|
|
1230
1275
|
def list_tables(self, bucket, schema, txid=0, client_tags=[], max_keys=1000, next_key=0, name_prefix="",
|
|
1231
1276
|
exact_match=False, expected_retvals=[], include_list_stats=False, count_only=False):
|
|
1277
|
+
def parse_properties(x):
|
|
1278
|
+
return x
|
|
1279
|
+
return self._list_tables_internal(bucket=bucket, schema=schema, txid=txid, client_tags=client_tags,
|
|
1280
|
+
parse_properties=parse_properties, max_keys=max_keys, next_key=next_key,
|
|
1281
|
+
name_prefix=name_prefix, exact_match=exact_match,
|
|
1282
|
+
expected_retvals=expected_retvals,
|
|
1283
|
+
include_list_stats=include_list_stats, count_only=count_only)
|
|
1284
|
+
|
|
1285
|
+
def _list_tables_internal(self, bucket, schema, parse_properties, txid=0, client_tags=[], max_keys=1000, next_key=0, name_prefix="",
|
|
1286
|
+
exact_match=False, expected_retvals=[], include_list_stats=False, count_only=False):
|
|
1232
1287
|
"""
|
|
1233
1288
|
GET /mybucket/schema_path?table HTTP/1.1
|
|
1234
1289
|
tabular-txid: TransactionId
|
|
@@ -1265,7 +1320,7 @@ class VastdbApi:
|
|
|
1265
1320
|
tables_length = lists.TablesLength()
|
|
1266
1321
|
count = int(res_headers['tabular-list-count']) if 'tabular-list-count' in res_headers else tables_length
|
|
1267
1322
|
for i in range(tables_length):
|
|
1268
|
-
tables.append(_parse_table_info(lists.Tables(i)))
|
|
1323
|
+
tables.append(_parse_table_info(lists.Tables(i), parse_properties))
|
|
1269
1324
|
|
|
1270
1325
|
return bucket_name, schema_name, tables, next_key, is_truncated, count
|
|
1271
1326
|
|
|
@@ -1837,7 +1892,7 @@ class VastdbApi:
|
|
|
1837
1892
|
raise ValueError(f'bucket: {bucket} did not start from {bucket_name}')
|
|
1838
1893
|
projections_length = lists.ProjectionsLength()
|
|
1839
1894
|
for i in range(projections_length):
|
|
1840
|
-
projections.append(_parse_table_info(lists.Projections(i)))
|
|
1895
|
+
projections.append(_parse_table_info(lists.Projections(i), lambda x: x))
|
|
1841
1896
|
|
|
1842
1897
|
return bucket_name, schema_name, table_name, projections, next_key, is_truncated, count
|
|
1843
1898
|
|
vastdb/bucket.py
CHANGED
|
@@ -40,7 +40,7 @@ class Bucket:
|
|
|
40
40
|
"""List bucket's schemas."""
|
|
41
41
|
return self._root_schema.schemas(batch_size=batch_size)
|
|
42
42
|
|
|
43
|
-
def snapshot(self, name, fail_if_missing=True) -> Optional["Bucket"]:
|
|
43
|
+
def snapshot(self, name: str, fail_if_missing=True) -> Optional["Bucket"]:
|
|
44
44
|
"""Get snapshot by name (if exists)."""
|
|
45
45
|
snapshots, _is_truncated, _next_key = \
|
|
46
46
|
self.tx._rpc.api.list_snapshots(bucket=self.name, name_prefix=name, max_keys=1)
|
vastdb/schema.py
CHANGED
|
@@ -122,8 +122,11 @@ class Schema:
|
|
|
122
122
|
if not is_truncated:
|
|
123
123
|
break
|
|
124
124
|
|
|
125
|
-
def tables(self, table_name=
|
|
126
|
-
"""List all tables under this schema.
|
|
125
|
+
def tables(self, table_name: str = "") -> List["Table"]:
|
|
126
|
+
"""List all tables under this schema if `table_name` is empty.
|
|
127
|
+
|
|
128
|
+
Otherwise, list only the specific table (if exists).
|
|
129
|
+
"""
|
|
127
130
|
return [
|
|
128
131
|
_parse_table_info(table_info, self)
|
|
129
132
|
for table_info in self._iter_tables(table_name=table_name)
|
vastdb/table.py
CHANGED
|
@@ -168,8 +168,11 @@ class Table:
|
|
|
168
168
|
log.debug("Found projection: %s", projs[0])
|
|
169
169
|
return projs[0]
|
|
170
170
|
|
|
171
|
-
def projections(self, projection_name=
|
|
172
|
-
"""List all semi-sorted projections of this table.
|
|
171
|
+
def projections(self, projection_name: str = "") -> Iterable["Projection"]:
|
|
172
|
+
"""List all semi-sorted projections of this table if `projection_name` is empty.
|
|
173
|
+
|
|
174
|
+
Otherwise, list only the specific projection (if exists).
|
|
175
|
+
"""
|
|
173
176
|
if self._imports_table:
|
|
174
177
|
raise errors.NotSupportedCommand(self.bucket.name, self.schema.name, self.name)
|
|
175
178
|
projections = []
|
|
@@ -523,7 +526,7 @@ class Table:
|
|
|
523
526
|
self.tx._rpc.api.drop_table(self.bucket.name, self.schema.name, self.name, txid=self.tx.txid, remove_imports_table=self._imports_table)
|
|
524
527
|
log.info("Dropped table: %s", self.name)
|
|
525
528
|
|
|
526
|
-
def rename(self, new_name) -> None:
|
|
529
|
+
def rename(self, new_name: str) -> None:
|
|
527
530
|
"""Rename this table."""
|
|
528
531
|
if self._imports_table:
|
|
529
532
|
raise errors.NotSupportedCommand(self.bucket.name, self.schema.name, self.name)
|
|
@@ -582,7 +585,7 @@ class Table:
|
|
|
582
585
|
self.tx._rpc.features.check_imports_table()
|
|
583
586
|
return Table(name=self.name, schema=self.schema, handle=int(self.handle), _imports_table=True)
|
|
584
587
|
|
|
585
|
-
def __getitem__(self, col_name):
|
|
588
|
+
def __getitem__(self, col_name: str):
|
|
586
589
|
"""Allow constructing ibis-like column expressions from this table.
|
|
587
590
|
|
|
588
591
|
It is useful for constructing expressions for predicate pushdown in `Table.select()` method.
|
|
@@ -630,7 +633,7 @@ class Projection:
|
|
|
630
633
|
self.arrow_schema = pa.schema([(col[0], col[1]) for col in columns])
|
|
631
634
|
return self.arrow_schema
|
|
632
635
|
|
|
633
|
-
def rename(self, new_name) -> None:
|
|
636
|
+
def rename(self, new_name: str) -> None:
|
|
634
637
|
"""Rename this projection."""
|
|
635
638
|
self.tx._rpc.api.alter_projection(self.bucket.name, self.schema.name,
|
|
636
639
|
self.table.name, self.name, txid=self.tx.txid, new_name=new_name)
|
|
@@ -151,15 +151,15 @@ vast_flatbuf/tabular/S3File.py,sha256=KC9c2oS5-JXwTTriUVFdjOvRG0B54Cq9kviSDZY3NI
|
|
|
151
151
|
vast_flatbuf/tabular/VipRange.py,sha256=_BJd1RRZAcK76T9vlsHzXKYVsPVaz6WTEAqStMQCAUQ,2069
|
|
152
152
|
vast_flatbuf/tabular/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
153
153
|
vastdb/__init__.py,sha256=J1JjKiFkKC95BHowfh9kJfQFTjRce-QMsc6zF_FfxC0,432
|
|
154
|
-
vastdb/_internal.py,sha256=
|
|
155
|
-
vastdb/bucket.py,sha256=
|
|
154
|
+
vastdb/_internal.py,sha256=pp5cfZ5z7eJIEN3OPHoemsOxW_mvQOiaYqLjFKwy5BQ,100003
|
|
155
|
+
vastdb/bucket.py,sha256=aomUbrfK5Oa6FdGPVsoBXgRW39IzYnmsorF8642r990,2549
|
|
156
156
|
vastdb/config.py,sha256=1tMYtzKXerGcIUjH4tIGEvZNWvO4fviCEdcNCnELJZo,2269
|
|
157
157
|
vastdb/conftest.py,sha256=X2kVveySPQYZlVBXUMoo7Oea5IsvmJzjdqq3fpH2kVw,3469
|
|
158
158
|
vastdb/errors.py,sha256=2XR1ko7J5nkfiHSAgwuVAADw0SsyqxOwSeFaGgKZEXM,4186
|
|
159
159
|
vastdb/features.py,sha256=DxV746LSkORwVSD6MP2hdXRfnyoLkJwtOwGmp1dnquo,1322
|
|
160
|
-
vastdb/schema.py,sha256=
|
|
160
|
+
vastdb/schema.py,sha256=ZokzIGWaiwWOSMpCtJnhWC09BFGl09LzoCMOb0wGoK0,6407
|
|
161
161
|
vastdb/session.py,sha256=toMR0BXwTaECdWDKnIZky1F3MA1SmelRBiqCrqQ3GCM,2067
|
|
162
|
-
vastdb/table.py,sha256=
|
|
162
|
+
vastdb/table.py,sha256=QoER7nHrJbvVh9PnRXz7Fae6UOksSRhKYlY4_7joT4I,31312
|
|
163
163
|
vastdb/transaction.py,sha256=NlVkEowJ_pmtffjWBBDaKExYDKPekjSZyj_fK_bZPJE,3026
|
|
164
164
|
vastdb/util.py,sha256=8CUnVRsJukC3uNHNoB5D0qPf0FxS8OSdVB84nNoLJKc,6290
|
|
165
165
|
vastdb/bench/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -204,8 +204,8 @@ vastdb/tests/util.py,sha256=dpRJYbboDnlqL4qIdvScpp8--5fxRUBIcIYitrfcj9o,555
|
|
|
204
204
|
vastdb/vast_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
205
205
|
vastdb/vast_tests/test_ha.py,sha256=744P4G6VJ09RIkHhMQL4wlipCBJWQVMhyvUrSc4k1HQ,975
|
|
206
206
|
vastdb/vast_tests/test_scale.py,sha256=5jGwOdZH6Tv5tPdZYPWoqcxOceI2jA5i2D1zNKZHER4,3958
|
|
207
|
-
vastdb-1.3.
|
|
208
|
-
vastdb-1.3.
|
|
209
|
-
vastdb-1.3.
|
|
210
|
-
vastdb-1.3.
|
|
211
|
-
vastdb-1.3.
|
|
207
|
+
vastdb-1.3.6.dist-info/LICENSE,sha256=obffan7LYrq7hLHNrY7vHcn2pKUTBUYXMKu-VOAvDxU,11333
|
|
208
|
+
vastdb-1.3.6.dist-info/METADATA,sha256=gK-e6PbBt--2QXu66EjsHbM1XuRIDxijU6KbMbHRJ4U,1340
|
|
209
|
+
vastdb-1.3.6.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
|
210
|
+
vastdb-1.3.6.dist-info/top_level.txt,sha256=Vsj2MKtlhPg0J4so64slQtnwjhgoPmJgcG-6YcVAwVc,20
|
|
211
|
+
vastdb-1.3.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|