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

Passwords containing # fail to connect using native interface #185

Closed
betelguez opened this issue Jul 25, 2022 · 0 comments
Closed

Passwords containing # fail to connect using native interface #185

betelguez opened this issue Jul 25, 2022 · 0 comments
Labels

Comments

@betelguez
Copy link

Describe the bug
A properly-encoded password containing # fails at client creation. SQLAlchemy decodes the password and returns the url to clickhouse-sqlalchemy, which in turn uses the from_url method of clickhouse-driver to create a Client using the raw url. urllib.parse which is used by clickhouse-driver to create the client incorrectly splits the url at the position of #

To Reproduce
(the code fails before it attempts to connect to an actual server; the below actually runs)

from urllib import parse
from sqlalchemy import create_engine
engine = create_engine(f"clickhouse+native://user:{parse.quote_plus('pass#word')}@server/database")
engine.execute("SELECT FOO FROM BAR")

ValueError: Port could not be cast to integer value as 'pass'

Expected behavior
A successful clickhouse client creation

Versions

  • clickhouse-sqlalchemy 0.2.1
  • python 3.10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants