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

Function sync_put_batch

src/sdk/python/sample.py:110–129  ·  view source on GitHub ↗

sync_put_batch

(table)

Source from the content-addressed store, hash-verified

108
109
110def sync_put_batch(table):
111 """ sync_put_batch """
112 print("\nsync put batch")
113 mutation_list = list()
114 for i in range(1, 1001):
115 if i == 3:
116 # valid rowkey should < 64K, otherwise an invalid argument
117 # mock error for batch put
118 mutation = table.NewRowMutation("k" * 64 * 1024 + "k")
119 else:
120 mutation = table.NewRowMutation(str(i))
121 mutation.Put("cf0", "qu0", "value" + str(i))
122 mutation_list.append(mutation)
123 table.BatchPut(mutation_list)
124 for m in mutation_list:
125 status = m.GetStatus()
126 if status.GetReasonNumber() != Status.OK:
127 print("put/write failed for key<" + m.RowKey()
128 + "> due to:" + status.GetReasonString())
129 m.Destroy()
130
131
132def sync_get_batch(table):

Callers 1

mainFunction · 0.85

Calls 8

BatchPutMethod · 0.80
GetReasonNumberMethod · 0.80
GetReasonStringMethod · 0.80
NewRowMutationMethod · 0.45
PutMethod · 0.45
GetStatusMethod · 0.45
RowKeyMethod · 0.45
DestroyMethod · 0.45

Tested by

no test coverage detected