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

# hashtag character causing error on authentication #426

Open
Syndorik opened this issue Dec 16, 2022 · 5 comments
Open

# hashtag character causing error on authentication #426

Syndorik opened this issue Dec 16, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@Syndorik
Copy link

Syndorik commented Dec 16, 2022

What language are you using?

Python

What version are you using?

0.3.1

What database are you using?

MySQL

What dataframe are you using?

Pandas,

Can you describe your bug?

I have a database with "#" character in their credentials. I can't connect to it because of the hashtag, tried with another user and it works.

What are the steps to reproduce the behavior?

Connect to a MySQL database with a user having a "#" credential in it

cx.read_sql("mysql://user:aa###aaa@address:3306/db", str(query)).iloc[:, 0].tolist()

What is the error?

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/ubuntu/.cache/pypoetry/virtualenvs/api-ObXpZerD-py3.9/lib/python3.9/site-packages/connectorx/__init__.py", line 224, in read_sql
    result = _read_sql(
RuntimeError: parse error: invalid port number
@Syndorik Syndorik added the bug Something isn't working label Dec 16, 2022
@wangxiaoying
Copy link
Contributor

Can you try to urlencode your password first (as well as other parts like server address and user name if they also include special characters) and see whether it works? Here is a reference: #319 (comment)

@parthlakhaniElligo
Copy link

Hi @wangxiaoying , I believe I'm having a similar issue (using connectorx python 0.3.2a5 and python 3.11.2).

I try to run cx.read_sql with a connection string containing a special character (in the password). If I url encode the password (with urllib.parse.quote_plus), I get RuntimeError: parse error: relative URL without a base. The server address doesn't have any special characters, and doesn't change when running it through urllib.parse.quote_plus; same with any other parts of the connection string.

Notably, the same exact connection string works to create a SQLAlchemy engine and execute a query.

Any ideas what I might be able to do to further troubleshoot? I appreciate any advice.

@avnav0
Copy link

avnav0 commented Aug 28, 2023

@parthlakhaniElligo same issue have you figured it out?

@parthlakhaniElligo
Copy link

@avnav0 I had abandoned this project for a while because I couldn't find a working solution. I recently returned to it and this appears to have been resolved in the final version of 0.3.2 (released on the day of your comment, I believe); the same connection string I tried before now works without error (still need to url encode the special-character-containing components, of course). Hope you've also had better luck!

@willdrotar
Copy link

In the latest version of polars this still throws this error, but wangxiaoying's solution still works great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants