connector-x icon indicating copy to clipboard operation
connector-x copied to clipboard

Error "Unknown authentication protocol: sha256_password" for queries to ClickHouse

Open ivkhokhlachev opened this issue 2 years ago • 7 comments

What language are you using?

Python

What version are you using?

0.3.1

What database are you using?

ClickHouse (over MySQL protocol)

What dataframe are you using?

Polars

What are the steps to reproduce the behavior?

  1. Create a user identified with sha256_password in ClickHouse: https://clickhouse.com/docs/en/sql-reference/statements/create/user/
  2. Try to run any query using connectorx
Example query / code
import connectorx
import polars

conn = f'mysql://{user}:{password}@{host}:9004/default'

-- both queries fail with the same error
polars.read_sql('select 1 as c', conn, protocol='text')
connectorx.read_sql(conn, 'select 1 as c', protocol='text')

What is the error?

RuntimeError: timed out waiting for connection: DriverError { Unknown authentication protocol: sha256_password }

ivkhokhlachev avatar Dec 09 '22 15:12 ivkhokhlachev

I also met with this issue

flyly0755 avatar Jan 13 '23 08:01 flyly0755

Hi, have you tried to urlencode your password? This may similar to this upstream issue

wangxiaoying avatar Jan 19 '23 23:01 wangxiaoying

@wangxiaoying no, this is not my case

ivkhokhlachev avatar Feb 03 '23 14:02 ivkhokhlachev

Hi, have you tried to urlencode your password? This may similar to this upstream issue

I've tried to encode with urllib.parse.quote_plus. Didn't help.

e10v avatar Apr 13 '23 16:04 e10v

I've just tried the same with user with plain password and it worked. So that means that connector-x doesn't work for users with sha256 password.

But console mysql client can connect to clickhouse with sha256 password. Maybe it can be done in connector-x as well?

e10v avatar Apr 13 '23 16:04 e10v

I've just tested. Pandas through native clickhouse protocol is x2 faster than connector-x through mysql protocol. So it's not worth it anyway.

And it's faster to read with pandas and convert to polars than read directly to polars with connector-x through mysql protocol.

e10v avatar Apr 13 '23 17:04 e10v

This issue still exists. Facing same issue

sairamkrish avatar Jul 10 '23 07:07 sairamkrish