From 45018497f33beb79cd8a8e0d136ba7eeb122900a Mon Sep 17 00:00:00 2001 From: Beto Dealmeida Date: Sat, 8 Jan 2022 12:29:42 -0800 Subject: [PATCH] fix: druid --- src/datajunction/cli/compile.py | 7 +++++-- tests/cli/compile_test.py | 4 +--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/datajunction/cli/compile.py b/src/datajunction/cli/compile.py index c3c7af50f..590c87d67 100644 --- a/src/datajunction/cli/compile.py +++ b/src/datajunction/cli/compile.py @@ -108,9 +108,12 @@ def get_columns(table: Table) -> List[Column]: table.table, schema=table.schema_, ) - except Exception as ex: # pylint: disable=broad-except + except Exception: # pylint: disable=broad-except + # Druid currently doesn't work with SQLAlchemy 1.4, and raises an exception. Once + # we've merged https://github.com/druid-io/pydruid/pull/275 we can modify this to + # re-raise the exception. _logger.exception("Unable to get table metadata") - raise ex + return [] return [ Column( diff --git a/tests/cli/compile_test.py b/tests/cli/compile_test.py index ef7777a40..0bbd875ee 100644 --- a/tests/cli/compile_test.py +++ b/tests/cli/compile_test.py @@ -135,9 +135,7 @@ def test_get_columns_error(mocker: MockerFixture) -> None: ) table = mocker.MagicMock() - with pytest.raises(Exception) as excinfo: - get_columns(table) - assert str(excinfo.value) == "An unexpected error occurred" + assert get_columns(table) == [] @pytest.mark.asyncio