Empty output
orl1k opened this issue · 11 comments
The same if i use WITH
Hi @orl1k, @polRk, can you provide some examples of your queries?
Since in last update I migrated to @ClickHouse/clickhouse-js, I'm using different methods for different types of queries:
If
query
starts with SELECT
then I use query
method, which has output, for others I use exec
method, which doesn't have output.But as I can see it was too reckless.
So, writing select
in lowercase also gives no results :)
@Leonqn oops, my bad, didn't notice that
I guess that can be fixed easily, so I will patch and release asap.
Also if you have newlines or spaces in the beginning of a query it also won't work.
Also if you have newlines or spaces in the beginning of a query it also won't work.
Yeah, also I can't uppercase whole query since that will change tables names, so it is needed to split query and take first item I believe
I think you can uppercase it like this
const method = query.toString().trimStart().toUpperCase().startsWith("SELECT") ? "query" : "exec";
It is a local uppercasing and won't change original query.
But complex queries with SELECT in the middle still won't work with this code
Are SELECT
and WITH
the only options for queries with output?
Found one more usecase for queries:
show create table your_table
This does not work with code lens https://vscode-sqltools.mteixeira.dev/en/features/codelens.html
-- @block
-- @conn clickhouse
SELECT * FROM X;