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

Database url cannot be parsed by python sqlalchemy #7

Closed
mateuszkj opened this issue Jul 7, 2023 · 0 comments · Fixed by #8
Closed

Database url cannot be parsed by python sqlalchemy #7

mateuszkj opened this issue Jul 7, 2023 · 0 comments · Fixed by #8

Comments

@mateuszkj
Copy link
Contributor

mateuszkj commented Jul 7, 2023

Problem

Python library sqlalchemy reject url with multiple hosts. This behavior has been changed recently.

url which is rejected:

postgresql://demo@localhost:5432/demo?host=/tmp/tmp-postgrust-socketKEpyHg

url which works:

postgresql://demo@:5432/demo?host=/tmp/tmp-postgrust-socketKEpyHg

Python exception

error:

  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/util/deprecations.py", line 281, in warned

    return fn(*args, **kwargs)  # type: ignore[no-any-return]

  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/create.py", line 617, in create_engine

    (cargs_tup, cparams) = dialect.create_connect_args(u)

  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/dialects/postgresql/_psycopg_common.py", line 134, in create_connect_args

    multihosts, multiports = self._split_multihost_from_url(url)

  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/dialects/postgresql/base.py", line 3149, in _split_multihost_from_url

    raise exc.ArgumentError(

sqlalchemy.exc.ArgumentError: Can't combine fixed host and multihost URL formats
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant