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

Tuple column #6

Closed ikrivosheev closed 3 years ago

ikrivosheev commented 3 years ago

First

  File "/home/ikrivosheev/.pyenv/versions/ptms-3.8.2/lib/python3.8/site-packages/asynch/proto/columns/tuplecolumn.py", line 55, in create_tuple_column
    return TupleColumn([column_by_spec_getter(x) for x in nested_columns])
  File "/home/ikrivosheev/.pyenv/versions/ptms-3.8.2/lib/python3.8/site-packages/asynch/proto/columns/tuplecolumn.py", line 9, in __init__
    super(TupleColumn, self).__init__(**kwargs)
TypeError: __init__() missing 2 required positional arguments: 'reader' and 'writer'

Second I create simple table:

CREATE TABLE IF NOT EXISTS test.test (
    id UInt64,
    values Array(Tuple(String, String))
)
...

and then i execute:

    async with conn.cursor(cursor=DictCursor) as cursor:
        ret = await cursor.execute("""INSERT INTO test.test VALUES""", [{"id": 1, "values": []}])

I got error:

  File "/home/ikrivosheev/.pyenv/versions/ptms-3.8.2/lib/python3.8/site-packages/asynch/proto/columns/tuplecolumn.py", line 22, in write_items
    return await self.write_data(items,)
  File "/home/ikrivosheev/.pyenv/versions/ptms-3.8.2/lib/python3.8/site-packages/asynch/proto/columns/tuplecolumn.py", line 17, in write_data
    await x.write_data(list(items[i]),)
IndexError: list index out of range
long2ice commented 3 years ago

That should be fix