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

ClickHouse driver: user/pass are ignored therefore connection fails #8963

Open
pachico opened this issue Jan 14, 2020 · 1 comment
Open

ClickHouse driver: user/pass are ignored therefore connection fails #8963

pachico opened this issue Jan 14, 2020 · 1 comment
Labels

Comments

@pachico
Copy link

@pachico pachico commented Jan 14, 2020

I am trying to connect to a ClickHouse cluster using your docker-compose based installation but once I add it as a new database it fails complaining

ERROR:root:Code: 194, e.displayText() = DB::Exception: Password required for user default (version 19.17.5.18 (official build))

although it is set in URI.

How to reproduce it:
I have appended sqlalchemy-clickhouse to the end of requirements-eextra.txt and run docker-compose up.
In add database form I set clickhouse://user:pass@clickhousehost:8123/mydb (obviously redacted here) and when pressing test connection I get a message in a popup:

ERROR: {"error": "Connection failed!\n\nThe error message returned was:\nCode: 194, e.displayText() = DB::Exception: Password required for user default (version 19.17.5.18 (official build))\n", "stacktrace": "Traceback (most recent call last):\n  File \"/app/superset/views/core.py\", line 1511, in testconn\n    with closing(engine.connect()) as conn:\n  File \"/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py\", line 2196, in connect\n    return self._connection_cls(self, **kwargs)\n  File \"/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py\", line 103, in __init__\n    else engine.raw_connection()\n  File \"/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py\", line 2296, in raw_connection\n    self.pool.unique_connection, _connection\n  File \"/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py\", line 2265, in _wrap_pool_connect\n    return fn()\n  File \"/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py\", line 303, in unique_connection\n    return _ConnectionFairy._checkout(self)\n  File \"/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py\", line 760, in _checkout\n    fairy = _ConnectionRecord.checkout(pool)\n  File \"/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py\", line 492, in checkout\n    rec = pool._do_get()\n  File \"/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/impl.py\", line 238, in _do_get\n    return self._create_connection()\n  File \"/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py\", line 308, in _create_connection\n    return _ConnectionRecord(self)\n  File \"/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py\", line 437, in __init__\n    self.__connect(first_connect_check=True)\n  File \"/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py\", line 639, in __connect\n    connection = pool._invoke_creator(self)\n  File \"/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py\", line 114, in connect\n    return dialect.connect(*cargs, **cparams)\n  File \"/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/default.py\", line 453, in connect\n    return self.dbapi.connect(*cargs, **cparams)\n  File \"/usr/local/lib/python3.6/site-packages/sqlalchemy_clickhouse/connector.py\", line 111, in connect\n    return Connection(*args, **kwargs)\n  File \"/usr/local/lib/python3.6/site-packages/sqlalchemy_clickhouse/connector.py\", line 118, in __init__\n    super(Connection, self).__init__(db_name, db_url, username, password, readonly)\n  File \"/usr/local/lib/python3.6/site-packages/infi/clickhouse_orm/database.py\", line 112, in __init__\n    self.db_exists = self._is_existing_database()\n  File \"/usr/local/lib/python3.6/site-packages/infi/clickhouse_orm/database.py\", line 393, in _is_existing_database\n    r = self._send(\"SELECT count() FROM system.databases WHERE name = '%s'\" % self.db_name)\n  File \"/usr/local/lib/python3.6/site-packages/sqlalchemy_clickhouse/connector.py\", line 102, in _send\n    raise Exception(r.text)\nException: Code: 194, e.displayText() = DB::Exception: Password required for user default (version 19.17.5.18 (official build))\n\n"}

and logs output

superset_1         | INFO:root:Database.get_sqla_engine(). Masked URL: clickhouse:///user:pass@clickhousehost:8123/mydb
superset_1         | DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): clickhousehost:8123
superset_1         | DEBUG:urllib3.connectionpool:http://clickhousehost:8123 "POST / HTTP/1.1" 401 None
superset_1         | ERROR:root:Code: 194, e.displayText() = DB::Exception: Password required for user default (version 19.17.5.18 (official build))
superset_1         | Traceback (most recent call last):
superset_1         |   File "/app/superset/views/core.py", line 1511, in testconn
superset_1         |     with closing(engine.connect()) as conn:
superset_1         |   File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 2196, in connect
superset_1         |     return self._connection_cls(self, **kwargs)
superset_1         |   File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 103, in __init__
superset_1         |     else engine.raw_connection()
superset_1         |   File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 2296, in raw_connection
superset_1         |     self.pool.unique_connection, _connection
superset_1         |   File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 2265, in _wrap_pool_connect
superset_1         |     return fn()
superset_1         |   File "/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 303, in unique_connection
superset_1         |     return _ConnectionFairy._checkout(self)
superset_1         |   File "/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 760, in _checkout
superset_1         |     fairy = _ConnectionRecord.checkout(pool)
superset_1         |   File "/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 492, in checkout
superset_1         |     rec = pool._do_get()
superset_1         |   File "/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/impl.py", line 238, in _do_get
superset_1         |     return self._create_connection()
superset_1         |   File "/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 308, in _create_connection
superset_1         |     return _ConnectionRecord(self)
superset_1         |   File "/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 437, in __init__
superset_1         |     self.__connect(first_connect_check=True)
superset_1         |   File "/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 639, in __connect
superset_1         |     connection = pool._invoke_creator(self)
superset_1         |   File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py", line 114, in connect
superset_1         |     return dialect.connect(*cargs, **cparams)
superset_1         |   File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 453, in connect
superset_1         |     return self.dbapi.connect(*cargs, **cparams)
superset_1         |   File "/usr/local/lib/python3.6/site-packages/sqlalchemy_clickhouse/connector.py", line 111, in connect
superset_1         |     return Connection(*args, **kwargs)
superset_1         |   File "/usr/local/lib/python3.6/site-packages/sqlalchemy_clickhouse/connector.py", line 118, in __init__
superset_1         |     super(Connection, self).__init__(db_name, db_url, username, password, readonly)
superset_1         |   File "/usr/local/lib/python3.6/site-packages/infi/clickhouse_orm/database.py", line 112, in __init__
superset_1         |     self.db_exists = self._is_existing_database()
superset_1         |   File "/usr/local/lib/python3.6/site-packages/infi/clickhouse_orm/database.py", line 393, in _is_existing_database
superset_1         |     r = self._send("SELECT count() FROM system.databases WHERE name = '%s'" % self.db_name)
superset_1         |   File "/usr/local/lib/python3.6/site-packages/sqlalchemy_clickhouse/connector.py", line 102, in _send
superset_1         |     raise Exception(r.text)
superset_1         | Exception: Code: 194, e.displayText() = DB::Exception: Password required for user default (version 19.17.5.18 (official build))
superset_1         | 
superset_1         | 172.20.0.1 - - [14/Jan/2020 12:48:15] "POST /superset/testconn HTTP/1.1" 500 -
superset_1         | INFO:werkzeug:172.20.0.1 - - [14/Jan/2020 12:48:15] "POST /superset/testconn HTTP/1.1" 500 -

It seems user and pass are ignored despite they are provided in URI.

@issue-label-bot

This comment has been minimized.

Copy link

@issue-label-bot issue-label-bot bot commented Jan 14, 2020

Issue-Label Bot is automatically applying the label #bug to this issue, with a confidence of 0.79. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@issue-label-bot issue-label-bot bot added the #bug label Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.