long2ice / asynch

An asyncio ClickHouse Python Driver with native (TCP) interface support.
https://github.com/long2ice/asynch
Apache License 2.0
186 stars 43 forks source link

`Code: 50. Unknown type Object('json')` when using JSON type #73

Closed samuelcolvin closed 1 year ago

samuelcolvin commented 1 year ago

It would be great to be able to insert data to a JSON type, at the moment it's causing an error.

Minimal Reproduction ```py import asyncio from asynch import connect from asynch.cursors import DictCursor async def demo(): conn = await connect() async with conn.cursor(cursor=DictCursor) as cursor: await cursor.execute('create database if not exists test') await cursor.execute('SET allow_experimental_object_type=1') await cursor.execute(""" CREATE TABLE if not exists test.json_type ( id Int32, json_data JSON ) ENGINE = MergeTree ORDER BY id""" ) ret = await cursor.execute( """INSERT INTO test.json_type(id, json_data) VALUES""", [ { "id": 1, "json_data": b'{"foo": "bar"}' } ], ) print(ret) if __name__ == '__main__': asyncio.run(demo()) ```
long2ice commented 1 year ago

Supported

samuelcolvin commented 1 year ago

amazing, thank you.