mirror of
https://github.com/hanzo-ds/connect.git
synced 2026-10-30 20:31:24 +00:00
10 lines
332 B
Python
10 lines
332 B
Python
from clickhouse_connect.driver import options
|
|
from clickhouse_connect.driver.types import ByteSource
|
|
|
|
|
|
def read_numpy_array(source: ByteSource, np_type: str, num_rows: int):
|
|
np = options.np
|
|
dtype = np.dtype(np_type)
|
|
buffer = source.read_bytes(dtype.itemsize * num_rows)
|
|
return np.frombuffer(buffer, dtype, num_rows)
|