python-pinot-dbapi / pinot-dbapi

Python DB-API and SQLAlchemy dialect for Pinot
MIT License
19 stars 33 forks source link

Fix TypeError when timeout is provided in connection string #106

Closed piby180 closed 1 month ago

piby180 commented 1 month ago

When timeout is provided as a query parameter in connection string, like the following

'pinot://localhost:8000/query/sql?controller='
       'http://localhost:9000/&&verify_ssl=True&&timeout=100'

we get TypeError : 'str' can't be converted to int

We need to convert timeout from string to int and then use it. This is fixed in this PR.

xiangfu0 commented 1 month ago

can you please fix the test ?

piby180 commented 1 month ago

@xiangfu0 Test has been fixed. The issue was that timeout in test here was being converted to 0 since int(0.001) = 0.

I have now used float() for timeout instead of int() which is also consistent with httpx as timeout datatype there is union of float and Nonetype.