Skip to content
Open
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
4 changes: 2 additions & 2 deletions pydruid/db/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ def do_ping(self, dbapi_connection) -> bool:
Return if the database can be reached.
"""
try:
dbapi_connection.execute(text("SELECT 1"))
except Exception as ex:
dbapi_connection.execute("SELECT 1")
Copy link
Contributor Author

@SamWheating SamWheating Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a partial revert of this commit, which caused test failures because text("SELECT 1") != "SELECT 1" .

Based on this previous PR, using text() here causes issues for SQLAlchemy and should be avoided.

cc @betodealmeida - do you know why this was changed back to text()?

except Exception:
return False

return True
Expand Down
2 changes: 2 additions & 0 deletions pydruid/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ def parse_datasource(datasource, query_type):
"Datasource definition not valid. Must be string or "
"dict or list of strings"
)
if isinstance(datasource, list):
Copy link
Contributor Author

@SamWheating SamWheating Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a revert of a change made in this commit, which I think was a breaking change to the generation of queries on union datasources. The PR doesn't offer additional details on this change, but the current code goes against the stated behaviour in the docstring and causes test failures.

It looks like the change in question never made it to a release, so I think it should be safe to just return to the previous behaviour.

return {"type": "union", "dataSources": datasource}
return datasource

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion tests/db/test_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def test_ssl_client_cert_authentication_with_patch_imported(
ANY,
stream=True,
headers={"Content-Type": "application/json"},
json={"query": "SELECT * FROM table", "context": {}, "header": False},
json={"query": "SELECT * FROM table", "context": {}, "header": True},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The header is set to True on line 352:

cursor = Cursor(url, header=True, ssl_client_cert="path/to/cert")

So I have to assume that the False here is just a typo 🤷

auth=ANY,
verify=True,
cert="path/to/cert",
Expand Down