diff --git a/clickhouse_sqlalchemy/drivers/native/base.py b/clickhouse_sqlalchemy/drivers/native/base.py index 54117843..fc16b794 100644 --- a/clickhouse_sqlalchemy/drivers/native/base.py +++ b/clickhouse_sqlalchemy/drivers/native/base.py @@ -54,10 +54,10 @@ def import_dbapi(cls): def create_connect_args(self, url): url = url.set(drivername='clickhouse') if url.username: - url = url.set(username=quote(url.username)) + url = url.set(username=url.username) if url.password: - url = url.set(password=quote(url.password)) + url = url.set(password=url.password) self.engine_reflection = asbool( url.query.get('engine_reflection', 'true') diff --git a/setup.py b/setup.py index d821846e..feb675da 100644 --- a/setup.py +++ b/setup.py @@ -96,7 +96,7 @@ def read_version(): packages=find_packages('.', exclude=["tests*"]), python_requires='>=3.7, <4', install_requires=[ - 'sqlalchemy>=2.0.0,<2.1.0', + 'sqlalchemy>=2.0.25,<2.1.0', 'requests', 'clickhouse-driver>=0.1.2', 'asynch>=0.2.2', diff --git a/tests/drivers/native/test_base.py b/tests/drivers/native/test_base.py index c2b32e94..dbe770f2 100644 --- a/tests/drivers/native/test_base.py +++ b/tests/drivers/native/test_base.py @@ -50,11 +50,23 @@ def test_no_auth(self): ) def test_quoting(self): - user = quote('us#er') - password = quote(' pass#word') + user = "us#er" + password = 'pass#word' part = '{}:{}@host/database'.format(user, password) + quote_user = quote(user) + quote_password = quote(password) + quote_part = '{}:{}@host/database'.format(quote_user, quote_password) + + # test with unquote user and password url = make_url('clickhouse+native://' + part) connect_args = self.dialect.create_connect_args(url) self.assertEqual( - str(connect_args[0][0]), 'clickhouse://' + part + str(connect_args[0][0]), 'clickhouse://' + quote_part + ) + + # test with quote user and password + url = make_url('clickhouse+native://' + quote_part) + connect_args = self.dialect.create_connect_args(url) + self.assertEqual( + str(connect_args[0][0]), 'clickhouse://' + quote_part ) diff --git a/testsrequire.py b/testsrequire.py index baa9d53a..a3f3691c 100644 --- a/testsrequire.py +++ b/testsrequire.py @@ -1,7 +1,7 @@ tests_require = [ 'pytest', - 'sqlalchemy>=2.0.0,<2.1.0', + 'sqlalchemy>=2.0.25,<2.1.0', 'greenlet>=2.0.1', 'alembic', 'requests',