Infinidat / infi.clickhouse_orm

A Python library for working with the ClickHouse database (https://clickhouse.yandex/)
BSD 3-Clause "New" or "Revised" License
414 stars 136 forks source link

`FORMAT TabSeparatedWithNamesAndTypes` added everywhere, produces massive syntax errors #186

Open pkit opened 2 years ago

pkit commented 2 years ago

Is this library even usable for modern ClickHouse?

a-589d5cf6cf-gns98 clickhouse-server 2021.12.17 18:08:19.778215 [ 89 ] {50b7182e-5f64-11ec-9274-0314ec6bd9da} <Debug> executeQuery: (from [::ffff:192.168.63.47]:46708, user: user) select currentDatabase() FORMAT TabSeparatedWithNamesAndTypes
a-589d5cf6cf-gns98 clickhouse-server 2021.12.17 18:08:19.893431 [ 89 ] {50b7182f-5f64-11ec-9274-0314ec6bd9da} <Debug> executeQuery: (from [::ffff:192.168.63.47]:46708, user: user) EXISTS TABLE users FORMAT TabSeparatedWithNamesAndTypes
a-589d5cf6cf-gns98 clickhouse-server 2021.12.17 18:08:20.008808 [ 89 ] {50b71830-5f64-11ec-9274-0314ec6bd9da} <Debug> executeQuery: (from [::ffff:192.168.63.47]:46708, user: user)  CREATE TABLE users ( id INTEGER NOT NULL, name VARCHAR, fullname VARCHAR, nickname VARCHAR, PRIMARY KEY (id) ) FORMAT TabSeparatedWithNamesAndTypes
a-589d5cf6cf-gns98 clickhouse-server 2021.12.17 18:08:20.008901 [ 89 ] {50b71830-5f64-11ec-9274-0314ec6bd9da} <Error> executeQuery: Code: 62. DB::Exception: Syntax error: failed at position 124 ('FORMAT') (line 10, col 2): FORMAT TabSeparatedWithNamesAndTypes. Expected one of: storage definition, ENGINE, AS. (SYNTAX_ERROR) (version 21.12.2.17 (official build)) (from [::ffff:192.168.63.47]:46708) (in query:  CREATE TABLE users ( id INTEGER NOT NULL, name VARCHAR, fullname VARCHAR, nickname VARCHAR, PRIMARY KEY (id) ) FORMAT TabSeparatedWithNamesAndTypes), Stack trace (when copying this message, always include the lines below):
mangototango commented 2 years ago

Hi, I just had a chance to run the tests in this library against ClickHouse 21.9.4 and 22.1.3 and did not encounter such errors. If I run select currentDatabase() FORMAT TabSeparatedWithNamesAndTypes in clickhouse-client, it works just fine. So I think the errors you saw are caused by something else.

pkit commented 2 years ago

It was create table that failed. If you look at logs. Obviously added format works for select and not create or insert.