MCPcopy Create free account
hub / github.com/PyTables/PyTables / copy5

Function copy5

bench/table-copy.py:90–110  ·  view source on GitHub ↗
(input_path, output_path)

Source from the content-addressed store, hash-verified

88
89
90def copy5(input_path, output_path):
91 print(f"copying data from {input_path} to {output_path}...")
92 input_file = tb.open_file(input_path, mode="r")
93 output_file = tb.open_file(output_path, mode="w", filters=filters)
94
95 input_table = input_file.root.test
96 output_table = output_file.create_table("/", "test", input_table.dtype)
97
98 chunksize = 100_000
99 rowsleft = len(input_table)
100 start = 0
101 for chunk in range(int(len(input_table) / chunksize) + 1):
102 stop = start + min(chunksize, rowsleft)
103 data = input_table.read(start, stop)
104 output_table.append(data)
105 output_table.flush()
106 rowsleft -= chunksize
107 start = stop
108
109 input_file.close()
110 output_file.close()
111
112
113if __name__ == "__main__":

Callers

nothing calls this directly

Calls 5

create_tableMethod · 0.45
readMethod · 0.45
appendMethod · 0.45
flushMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected