pyexasol icon indicating copy to clipboard operation
pyexasol copied to clipboard

DSN parser does not detect invalid patterns

Open tomuben opened this issue 4 months ago • 0 comments

Checklist

In order to speedup fixing the bug, please make sure you address as many items from the following checklist as possible.

  • [x] I have reproduced the issue with the latest released version of PyExasol.
  • [ ] I have added references to issues that sound similar in section Related Issues.

Summary

DSN Parser does not detect wrong DSN values, for example "localhost:8563/123" (fingerprint behind port)

Reproducing the Issue

See unit test dsn_test.py::test_invalid_fingerprint.

Steps to reproduce the behavior:

Create EXAConnection() with dsn = "localhost:8563/123" => pyexasol will try to establish a connection with invalid host "localhost:8563" (note: this is the host name!!!).

Expected Behaviour

pyexasol should detect invalid patterns for DSN correctly and raise an exception before trying to establish a connection.

Actual Behaviour

pexasol tries to establish a websocket connection to an invalid host name if the DSN has incorrect format. This might lead to confusing error messages.

Root Cause (optional)

Regular expression in connection.py are not enough.

Additional Context (optional)

Possibly the implementation needs to use a real parser instead of just regular expressions, like: https://github.com/lark-parser/lark

tomuben avatar Sep 04 '25 17:09 tomuben