You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug client.insert_dataframe() method throws if the table contains tuple column
To Reproduce
Suppose I have the following table:
CREATE TABLE IF NOT EXISTS tt
(
a Tuple(x Float32, y Float32),
)
ENGINE = Memory;
INSERT INTO tt VALUES ((0.0, 0.0))
I can query this table in different ways:
client.query_dataframe("SELECT * FROM tt", settings={'use_numpy': False})
which gives a dataframe of form:
a
0 (0.0, 0.0)
client.query_dataframe("SELECT * FROM tt", settings={'use_numpy': False, 'namedtuple_as_json': True, 'allow_experimental_object_type': 1})
which gives a dataframe of form:
a
0 {'x': 0.0, 'y': 0.0}
However, I'm struggling with inserting new data.
Both
df = pd.DataFrame([{'a': (0.1, 0.1),},])
db.client.insert_dataframe(f"INSERT INTO tt VALUES", df)
The same with df = pd.DataFrame([{'a': {'x': 0.1, 'y': 0.1},},]) throws:
TypeMismatchError: Code: 53. Type mismatch in VALUES section. Repeat query with types_check=True for detailed info. Column a: required argument is not a float
Expected behavior
I expected at least one of client.insert_dataframe() above to work
Versions
clickhouse-driver 0.2.7
ClickHouse server 24.1.2.5
Python 3.11.6.
The text was updated successfully, but these errors were encountered:
Describe the bug
client.insert_dataframe()
method throws if the table contains tuple columnTo Reproduce
Suppose I have the following table:
I can query this table in different ways:
client.query_dataframe("SELECT * FROM tt", settings={'use_numpy': False})
which gives a dataframe of form:
client.query_dataframe("SELECT * FROM tt", settings={'use_numpy': False, 'namedtuple_as_json': True, 'allow_experimental_object_type': 1})
which gives a dataframe of form:
However, I'm struggling with inserting new data.
Both
and
throw this exception:
The same but with
settings={'use_numpy': False}
throws:So the only way I can insert new data at the moment is:
The same with
df = pd.DataFrame([{'a': {'x': 0.1, 'y': 0.1},},])
throws:Expected behavior
I expected at least one of
client.insert_dataframe()
above to workVersions
The text was updated successfully, but these errors were encountered: