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

fix httpx timeout issue #105

Merged
merged 1 commit into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ wheels/
.installed.cfg
*.egg
.vscode/
.DS_Store

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
1 change: 1 addition & 0 deletions pinotdb/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ def __init__(
# TODO: Remove this unused parameter when we can afford to break the
# interface (e.g. new minor version).
verify_ssl=True,
timeout=10,
extra_request_headers="",
debug=False,
preserve_types=False,
Expand Down
3 changes: 3 additions & 0 deletions pinotdb/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ def __init__(self, *args, **kwargs):
self._password = None
self._debug = False
self._verify_ssl = True
self._timeout = 10.0
self._database = None
self.update_from_kwargs(kwargs)

Expand All @@ -181,6 +182,7 @@ def update_from_kwargs(self, givenkw):
kwargs["database"] = self._database = kwargs.pop("database")
kwargs["debug"] = self._debug = bool(kwargs.get("debug", False))
kwargs["verify_ssl"] = self._verify_ssl = (str(kwargs.get("verify_ssl", "true")).lower() in ['true'])
kwargs["timeout"] = self._timeout = kwargs.get("timeout", None)
logger.info(
"Updated pinot dialect args from %s: %s and %s",
dict(map(lambda kv: (kv[0], mask_value(kv[0], kv[1], ['password'])), kwargs.items())),
Expand All @@ -207,6 +209,7 @@ def create_connect_args(self, url):
"username": url.username,
"password": url.password,
"verify_ssl": self._verify_ssl or True,
"timeout": self._timeout or 10.0,
}
if self.engine_type == "multi_stage":
kwargs.update({"use_multistage_engine": True})
Expand Down
14 changes: 7 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions tests/unit/test_sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def test_creates_connection_args(self):
'username': None,
'password': None,
'verify_ssl': True,
'timeout': 10.0,
})

def test_creates_connection_args_without_query(self):
Expand All @@ -73,6 +74,7 @@ def test_creates_connection_args_without_query(self):
'username': None,
'password': None,
'verify_ssl': True,
'timeout': 10.0,
})

def test_can_instantiate_with_server(self):
Expand Down Expand Up @@ -282,6 +284,7 @@ def test_creates_connection_args(self):
'username': None,
'password': None,
'verify_ssl': True,
'timeout': 10.0,
'use_multistage_engine': True,
})

Expand Down
Loading