mirror of
https://github.com/hanzo-ds/connect.git
synced 2026-10-30 20:31:24 +00:00
* migrate from pylint to ruff * ruff format/lint switch over * add formatting commit * update changelog
11 lines
442 B
Python
11 lines
442 B
Python
import clickhouse_connect
|
|
|
|
if __name__ == "__main__":
|
|
client = clickhouse_connect.get_client()
|
|
query = "SELECT number, toString(number) AS number_as_str FROM system.numbers LIMIT 5"
|
|
fmt = "CSVWithNames" # or any other format, see https://clickhouse.com/docs/en/interfaces/formats
|
|
stream = client.raw_stream(query=query, fmt=fmt)
|
|
with open("output.csv", "wb") as f:
|
|
for chunk in stream:
|
|
f.write(chunk)
|