Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deleting the "default" database kills the connector #309

Closed
gauvins2 opened this issue May 14, 2022 · 5 comments
Closed

deleting the "default" database kills the connector #309

gauvins2 opened this issue May 14, 2022 · 5 comments

Comments

@gauvins2
Copy link

Describe the bug
After deleting the "default" database
To Reproduce
from clickhouse_driver import Client
cx = Client('localhost')
theResult = cx.execute(theQuery)

(any query will do)

Expected behavior
data should be returned.
Versions
CH-driver 0.2.[3-4]
CH 22.4.5.9
Python 3.10.4

Error on socket shutdown: [Errno 107] Transport endpoint is not connected
Traceback (most recent call last):
File "/home/gauvins/.local/lib/python3.10/site-packages/clickhouse_driver/dbapi/cursor.py", line 111, in execute
response = execute(
File "/home/gauvins/.local/lib/python3.10/site-packages/clickhouse_driver/client.py", line 296, in execute
rv = self.process_ordinary_query(
File "/home/gauvins/.local/lib/python3.10/site-packages/clickhouse_driver/client.py", line 482, in process_ordinary_query
return self.receive_result(with_column_types=with_column_types,
File "/home/gauvins/.local/lib/python3.10/site-packages/clickhouse_driver/client.py", line 143, in receive_result
return result.get_result()
File "/home/gauvins/.local/lib/python3.10/site-packages/clickhouse_driver/result.py", line 50, in get_result
for packet in self.packet_generator:
File "/home/gauvins/.local/lib/python3.10/site-packages/clickhouse_driver/client.py", line 159, in packet_generator
packet = self.receive_packet()
File "/home/gauvins/.local/lib/python3.10/site-packages/clickhouse_driver/client.py", line 176, in receive_packet
raise packet.exception
clickhouse_driver.errors.ServerException: Code: 81.
DB::Exception: Database default doesn't exist. Stack trace:

@xzkostyan
Copy link
Member

Current behaviour is correct. clickhouse-client has the same:

$ clickhouse-client --query 'select 1'
1
$ clickhouse-client -d not-existent-database --query 'select 1'
Received exception from server (version 22.4.3):
Code: 81. DB::Exception: Received from localhost:9000. DB::Exception: Database `not-existent-database` doesn't exist. (UNKNOWN_DATABASE)
(query: select 1)

@gauvins2
Copy link
Author

Clickhouse-client was working on my system (the query specifies a database. Will bork if no database is specified)

@xzkostyan
Copy link
Member

I see. It would be nice if you could post full motivation in expected behaviour. Including clickhouse-client examples and particular queries.

@gauvins2
Copy link
Author

  1. A query like "SELECT COUNT() FROM myDB.myTable" should execute even if the [default] db has been deleted

motivation is simply that I deleted [default] because I like clean environments. Took me a while to figure out why the driver didn't work. In the meantime I've re-created an empty default DB

xzkostyan added a commit that referenced this issue May 15, 2022
xzkostyan added a commit that referenced this issue May 15, 2022
@xzkostyan
Copy link
Member

Fix was merged into master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants