Skip to content

Commit

Permalink
Merge branch 'main' into fix/cross-account-delete-table
Browse files Browse the repository at this point in the history
  • Loading branch information
nicor88 authored Sep 7, 2023
2 parents 34fd055 + 23478ef commit bfd07b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 2 additions & 4 deletions dbt/adapters/athena/config.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import importlib.metadata
from functools import lru_cache

import pkg_resources
from botocore import config


@lru_cache()
def get_boto3_config() -> config.Config:
return config.Config(
user_agent_extra="dbt-athena-community/" + pkg_resources.get_distribution("dbt-athena-community").version
)
return config.Config(user_agent_extra="dbt-athena-community/" + importlib.metadata.version("dbt-athena-community"))
5 changes: 2 additions & 3 deletions tests/unit/test_config.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import importlib.metadata
from unittest.mock import Mock

import pkg_resources

from dbt.adapters.athena.config import get_boto3_config


class TestConfig:
def test_get_boto3_config(self):
pkg_resources.get_distribution = Mock(return_value=pkg_resources.Distribution(version="2.4.6"))
importlib.metadata.version = Mock(return_value="2.4.6")
get_boto3_config.cache_clear()
config = get_boto3_config()
assert config._user_provided_options["user_agent_extra"] == "dbt-athena-community/2.4.6"

0 comments on commit bfd07b2

Please sign in to comment.