sfu-db / connector-x

Fastest library to load data from DB to DataFrames in Rust and Python
https://sfu-db.github.io/connector-x
MIT License
1.85k stars 146 forks source link

parse error: invalid port number with Postgres on Python 0.3.1 #554

Closed danielgafni closed 7 months ago

danielgafni commented 7 months ago

What language are you using?

Python

What version are you using?

0.3.1

What database are you using?

PostgreSQL

What dataframe are you using?

Polars

Can you describe your bug?

Any query fails with

File /usr/local/lib/python3.9/site-packages/polars/io/database.py:737, in _read_sql_connectorx(query, connection_uri, partition_on, partition_range, partition_num, protocol, schema_overrides)
    734 except BaseException as err:
    735     # basic sanitisation of /user:pass/ credentials exposed in connectorx errs
    736     errmsg = re.sub("://[^:]+:[^:]+@", "://***:***@", str(err))
--> 737     raise type(err)(errmsg) from err
    739 return from_arrow(tbl, schema_overrides=schema_overrides)

RuntimeError: parse error: invalid port number

while the connection string is actually correct. Here is the actual string (with the password masked):

postgresql://dagster:***@dagster-proxy.proxy-cwdkw65rxysj.us-east-1.rds.amazonaws.com:5432/dagster

it works with sqlalchemy.

What are the steps to reproduce the behavior?

If possible, please include a minimal simple example including:

Database setup if the error only happens on specific data or data type

Any setup, the error happens before doing the query

Example query / code

Any query

What is the error?

RuntimeError: parse error: invalid port number
danielgafni commented 7 months ago

actually seems like an issue with polars