clickhouse-driver
clickhouse-driver copied to clipboard
Exception when inserting into a Dynamic type
Describe the bug
I get this error when trying to insert data into a a table with a dynamic type. Actually a map
with Dynamic
values.
Insertions without dynamic types work fine.
Schema of the table:
# | ColumnName | DataType |
---|---|---|
1 | EventReceivedTime | DateTime64(3) |
2 | Name | LowCardinality(String) |
3 | Type | LowCardinality(String) |
4 | data | Map(LowCardinality(String), Dynamic) |
Error I get:
Traceback (most recent call last):
File "C:\Users\bened\AppData\Local\Programs\Python\Python311\Lib\site-packages\clickhouse_driver\columns\service.py", line 139, in get_column_by_spec
cls = column_by_type[spec]
~~~~~~~~~~~~~~^^^^^^
KeyError: 'Dynamic'
To Reproduce
record = (
EventReceivedTime,
Name,
Type
,
json.dumps({
'clientID': clientID,
'message' : message
})
)
records.append(record)
query = f'INSERT INTO {table_name} (EventReceivedTime,Name,Type,data) VALUES'
client.execute(query, records)
Expected behavior I would expect the code to work unless Dynamc types aren't explicitly supported.
Versions
- Version of clickhouse-driver: 0.2.9
- ClickHouse server version: 24.6.2.17
- Python version. 3.11.4