diff --git a/pydruid/db/sqlalchemy.py b/pydruid/db/sqlalchemy.py index 76b7a3c1..42336fb7 100644 --- a/pydruid/db/sqlalchemy.py +++ b/pydruid/db/sqlalchemy.py @@ -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") + except Exception: return False return True diff --git a/pydruid/query.py b/pydruid/query.py index f95209d1..df2955e9 100644 --- a/pydruid/query.py +++ b/pydruid/query.py @@ -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): + return {"type": "union", "dataSources": datasource} return datasource @staticmethod diff --git a/tests/db/test_cursor.py b/tests/db/test_cursor.py index a98d3335..dede75fd 100644 --- a/tests/db/test_cursor.py +++ b/tests/db/test_cursor.py @@ -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}, auth=ANY, verify=True, cert="path/to/cert",