diff --git a/dbt-athena/src/dbt/adapters/athena/impl.py b/dbt-athena/src/dbt/adapters/athena/impl.py index 6eace2da3..692672759 100755 --- a/dbt-athena/src/dbt/adapters/athena/impl.py +++ b/dbt-athena/src/dbt/adapters/athena/impl.py @@ -1452,3 +1452,14 @@ def _run_query(self, sql: str, catch_partitions_limit: bool) -> AthenaCursor: LOGGER.debug(f"CAUGHT EXCEPTION: {e}") raise e return cursor + + @classmethod + def _get_adapter_specific_run_info(cls, config: RelationConfig) -> Dict[str, Any]: + try: + table_format = config._extra.get("table_type") + except AttributeError: + table_format = None + return { + "adapter_type": "athena", + "table_format": table_format, + } diff --git a/dbt-athena/tests/functional/adapter/test_retries_iceberg.py b/dbt-athena/tests/functional/adapter/test_retries_iceberg.py index e9bf26827..6808c1c16 100644 --- a/dbt-athena/tests/functional/adapter/test_retries_iceberg.py +++ b/dbt-athena/tests/functional/adapter/test_retries_iceberg.py @@ -60,6 +60,9 @@ seeds__expected_target_post = "id,status\n" + "\n".join([f"{i},{i}" for i in range(PARALLELISM)]) +@pytest.mark.skip( + reason="Unreliable test in practice. No apparent reliable way to trigger a retry, which causes the test to fail. Disabled until we get a resolution here https://github.com/dbt-labs/dbt-athena/pull/657/files#r1922043351" +) class TestIcebergRetriesDisabled: @pytest.fixture(scope="class") def dbt_profile_target(self): diff --git a/dbt-athena/tests/unit/test_adapter_telemetry.py b/dbt-athena/tests/unit/test_adapter_telemetry.py new file mode 100644 index 000000000..de96b993c --- /dev/null +++ b/dbt-athena/tests/unit/test_adapter_telemetry.py @@ -0,0 +1,28 @@ +from unittest import mock + +import dbt.adapters.athena.__version__ + +from dbt.adapters.athena.impl import AthenaAdapter +from dbt.adapters.base.relation import AdapterTrackingRelationInfo + + +def test_telemetry_with_athena_details(): + mock_model_config = mock.MagicMock() + mock_model_config._extra = mock.MagicMock() + mock_model_config._extra = { + "adapter_type": "athena", + "table_type": "iceberg", + } + + res = AthenaAdapter.get_adapter_run_info(mock_model_config) + + assert res.adapter_name == "athena" + assert res.base_adapter_version == dbt.adapters.__about__.version + assert res.adapter_version == dbt.adapters.athena.__version__.version + + assert res.model_adapter_details == { + "adapter_type": "athena", + "table_format": "iceberg", + } + + assert isinstance(res, AdapterTrackingRelationInfo)