MCPcopy Create free account
hub / github.com/baidu/tera / scan

Function scan

src/sdk/python/sample.py:243–263  ·  view source on GitHub ↗

scan

(table)

Source from the content-addressed store, hash-verified

241
242
243def scan(table):
244 """ scan """
245 print("\nscan")
246 from TeraSdk import ScanDescriptor
247 scan_desc = ScanDescriptor("")
248 scan_desc.SetBufferSize(1024 * 1024) # 1MB
249 try:
250 stream = table.Scan(scan_desc)
251 except TeraSdkException as e:
252 print(e.reason)
253 return
254
255 while not stream.Done():
256 row = stream.RowName()
257 column = stream.ColumnName()
258 timestamp = str(stream.Timestamp())
259 val = stream.Value()
260 print row + ":" + column + ":" + timestamp + ":" + val
261 stream.Next()
262 scan_desc.Destroy()
263 stream.Destroy()
264
265
266if __name__ == '__main__':

Callers 1

mainFunction · 0.85

Calls 11

SetBufferSizeMethod · 0.95
DestroyMethod · 0.95
ScanDescriptorClass · 0.90
ScanMethod · 0.45
DoneMethod · 0.45
RowNameMethod · 0.45
ColumnNameMethod · 0.45
TimestampMethod · 0.45
ValueMethod · 0.45
NextMethod · 0.45
DestroyMethod · 0.45

Tested by

no test coverage detected