Closed auxten closed 1 year ago
π
I'm interested in making this work! But I'll need some pointers!
This is also a problem for me in my clickhouse-local
Elixir wrapper https://github.com/ruslandoga/ch_local as I need to prefix the database name for all ops and --database
flag doesn't seem to work.
Welcome to the chdbunch @ruslandoga π
If this also happens in a clickhouse-local wrapper and --database
doesn't work there's a chance this is a general ClickHouse issue. Was it ever reported to CH as part of your testing @ruslandoga ?
No, I haven't reported it. I'll ask in https://t.me/clickhouse_ru if my understanding of how it is supposed to work is correct and open an issue on ClickHouse :)
Basically, here's the idea:
This should work in clickhouse-local. Here's a starting point to crawl back from
Indeed --database
argument don't work as expected in clickhouse local (I'll check how to fix it. Probably it's not implemented because no so many database exists when clickhouse-local is just started).
However USE database
does. Likely issue with --database
related to handling of command line args.
I believe issue somewhere in context usage in chs.Session()
. We need to store context in there and use this context for queries in that session.
I thought a bit more about this and realised that having support for --database
is better for my use case, it'd be more in line with the :database
option we have in the HTTP client in Elixir. I also looked into how chs.Session()
works, and it seems to me it just adds a --path
option to the query_stable
? If so, I'm not sure how to cleanly intercept use <database>
commands and where to store that context in Python, and even if it is stored, how to provide it to query_stable
if --database
doesn't work. So I guess the changes need to be done in C++ but that seems more complicated than making --database
option work.
clickhouse-local
issue with --database
argument is inside command line options parsing https://github.com/ClickHouse/ClickHouse/pull/54503
I thought a bit more about this and realised that having support for
--database
is better for my use case, it'd be more in line with the:database
option we have in the HTTP client in Elixir. I also looked into howchs.Session()
works, and it seems to me it just adds a--path
option to thequery_stable
? If so, I'm not sure how to cleanly interceptuse <database>
commands and where to store that context in Python, and even if it is stored, how to provide it toquery_stable
if--database
doesn't work. So I guess the changes need to be done in C++ but that seems more complicated than making--database
option work.
There are also some code to write to store the "Using" db name in a temp file and pass it via --database
.
@ruslandoga are you still working on this?
π @auxten
No, I think the long lived client approach works better for me :) Plus now that the --database
option is fixed in the local client I can just use that similar to how it's done in the HTTP client.
Nice, I am also inspired by the long-lived client approach #108. It will be a better solution for interactive queries. I will try to:
use db_xxx
work in the old way first.Thanks for you guys.πΊ
any update on this ?
any update on this ?
Will be ready when v0.16.0 stable version released
would love to test the rc but no python release is available yet :(
@djouallah you can install it by specifying the version :
pip install chdb==0.16.0rc2
@djouallah you can install it by specifying the version :
pip install chdb==0.16.0rc2
Not this version, after we fix the build pipeline issue. I will draft a new version.
would love to test the rc but no python release is available yet :(
here you go! pip install chdb==1.0.0rc1
See also: #82