long2ice / asynch

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

asynch.errors.UnknownTypeError: Code: 50. Unknown type Date32 #95

Closed cortelf closed 8 months ago

cortelf commented 8 months ago

Python: 3.12.0 ashynch: 0.2.3 ClickHouse: 23.8.5.16

Code

import asyncio

from asynch import connect

async def connect_database():
    conn = await connect("")
    async with conn.cursor() as cursor:
        await cursor.execute("""select makeDate32(1950, 06, 06);""")
        ret = await cursor.fetchall()
        print(ret)

asyncio.run(connect_database())

Traceback

Traceback (most recent call last):
  File "C:\Users\Cortel\AppData\Local\pypoetry\Cache\virtualenvs\test-asynch-date-issue-CodK8wwF-py3.12\Lib\site-packages\asynch\proto\columns\__init__.py", line 140, in get_column_by_spec
    cls = column_by_type[spec]
          ~~~~~~~~~~~~~~^^^^^^
KeyError: 'Date32'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Cortel\Projects\Useless\test_asynch_date_issue\main.py", line 13, in <module>
    asyncio.run(connect_database())
  File "C:\Users\Cortel\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\Cortel\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Cortel\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 664, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\Cortel\Projects\Useless\test_asynch_date_issue\main.py", line 9, in connect_database
    await cursor.execute("""select makeDate32(1950, 06, 06);""")
  File "C:\Users\Cortel\AppData\Local\pypoetry\Cache\virtualenvs\test-asynch-date-issue-CodK8wwF-py3.12\Lib\site-packages\asynch\cursors.py", line 60, in execute
    response = await execute(query, args=args, with_column_types=True, **execute_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Cortel\AppData\Local\pypoetry\Cache\virtualenvs\test-asynch-date-issue-CodK8wwF-py3.12\Lib\site-packages\asynch\proto\connection.py", line 633, in execute
    async with ExecuteContext(self, query, settings):
  File "C:\Users\Cortel\AppData\Local\pypoetry\Cache\virtualenvs\test-asynch-date-issue-CodK8wwF-py3.12\Lib\site-packages\asynch\proto\context.py", line 60, in __aexit__
    raise exc_val
  File "C:\Users\Cortel\AppData\Local\pypoetry\Cache\virtualenvs\test-asynch-date-issue-CodK8wwF-py3.12\Lib\site-packages\asynch\proto\connection.py", line 648, in execute
    rv = await self.process_ordinary_query(
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Cortel\AppData\Local\pypoetry\Cache\virtualenvs\test-asynch-date-issue-CodK8wwF-py3.12\Lib\site-packages\asynch\proto\connection.py", line 775, in process_ordinary_query
    return await self.receive_result(with_column_types=with_column_types, columnar=columnar)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Cortel\AppData\Local\pypoetry\Cache\virtualenvs\test-asynch-date-issue-CodK8wwF-py3.12\Lib\site-packages\asynch\proto\connection.py", line 498, in receive_result
    return await result.get_result()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Cortel\AppData\Local\pypoetry\Cache\virtualenvs\test-asynch-date-issue-CodK8wwF-py3.12\Lib\site-packages\asynch\proto\result.py", line 56, in get_result
    async for packet in self.packet_generator:
  File "C:\Users\Cortel\AppData\Local\pypoetry\Cache\virtualenvs\test-asynch-date-issue-CodK8wwF-py3.12\Lib\site-packages\asynch\proto\connection.py", line 477, in packet_generator
    packet = await self.receive_packet()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Cortel\AppData\Local\pypoetry\Cache\virtualenvs\test-asynch-date-issue-CodK8wwF-py3.12\Lib\site-packages\asynch\proto\connection.py", line 403, in receive_packet
    packet = await self._receive_packet()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Cortel\AppData\Local\pypoetry\Cache\virtualenvs\test-asynch-date-issue-CodK8wwF-py3.12\Lib\site-packages\asynch\proto\connection.py", line 437, in _receive_packet
    packet.block = await self.receive_data()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Cortel\AppData\Local\pypoetry\Cache\virtualenvs\test-asynch-date-issue-CodK8wwF-py3.12\Lib\site-packages\asynch\proto\connection.py", line 340, in receive_data
    return await (self.block_reader_raw if raw else self.block_reader).read()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Cortel\AppData\Local\pypoetry\Cache\virtualenvs\test-asynch-date-issue-CodK8wwF-py3.12\Lib\site-packages\asynch\proto\streams\block.py", line 82, in read
    column = await read_column(
             ^^^^^^^^^^^^^^^^^^
  File "C:\Users\Cortel\AppData\Local\pypoetry\Cache\virtualenvs\test-asynch-date-issue-CodK8wwF-py3.12\Lib\site-packages\asynch\proto\columns\__init__.py", line 155, in read_column
    column = get_column_by_spec(column_spec, column_options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Cortel\AppData\Local\pypoetry\Cache\virtualenvs\test-asynch-date-issue-CodK8wwF-py3.12\Lib\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