long2ice / asynch

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

`Unknown type Date32` when inserting data into a `Date32` field #79

Open hramezani opened 1 year ago

hramezani commented 1 year ago

Getting asynch.errors.UnknownTypeError when inserting data into a Date32 field:

  File "lib/python3.11/site-packages/asynch/proto/columns/__init__.py", line 144, in get_column_by_spec
    raise UnknownTypeError("Unknown type {}".format(e.args[0]))
asynch.errors.UnknownTypeError: Code: 50. Unknown type Date32

Here is a minimal script to reproduce the bug:

import asyncio
from datetime import date

import asynch

async def main():
    pool = await asynch.create_pool(minsize=5)
    async with pool.acquire() as conn:
        async with conn.cursor() as cursor:
            await cursor.execute('CREATE DATABASE IF NOT EXISTS test')
            await cursor.execute('CREATE TABLE if not exists test.test (date Date32) ENGINE = MergeTree order by date')

            await cursor.execute('INSERT INTO test.test (date) VALUES', [{'date': date.today()}])

asyncio.run(main())
3FANG commented 7 months ago

https://github.com/long2ice/asynch/commit/020971fe8641b48c1133f311c8be74330816eedf