long2ice / asynch

An asyncio ClickHouse Python Driver with native (TCP) interface support.

Home Page:https://github.com/long2ice/asynch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

hramezani opened this issue · comments

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())