Skip to content

Commit

Permalink
Merge pull request #83 from dpguthrie/fix/default-domain
Browse files Browse the repository at this point in the history
Fix default domain logic
  • Loading branch information
dpguthrie authored Apr 4, 2023
2 parents 5c6203b + 64384d6 commit eaddd47
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [0.4.2] - 2023-04-03

### Fixed
- How the base URL was constructed as it was not properly accounting for other regions, single tenant instances properly

## [0.4.1] - 2023-04-02

### Added
Expand Down
2 changes: 1 addition & 1 deletion dbtc/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.4.1'
__version__ = '0.4.2'
1 change: 0 additions & 1 deletion dbtc/client/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ def __init__(self, **kwargs):
*flags, **{k: v for k, v in arg_specs.items() if k != 'flags'}
)

_default_domain = 'cloud.getdbt.com'
_path = None

@property
Expand Down
7 changes: 2 additions & 5 deletions dbtc/client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,14 @@ def __init__(
'DBT_CLOUD_SERVICE_TOKEN', None
)
self._host: Optional[str] = host or os.getenv(
'DBT_CLOUD_HOST', self._default_domain
'DBT_CLOUD_HOST', self.DEFAULT_DOMAIN
)
self.do_not_track: bool = do_not_track
self._anonymous_id: str = str(uuid.uuid4())
self._called_from: Optional[str] = None
self.console = err_console

@property
@abc.abstractmethod
def _default_domain(self):
"""Default used when host is not provided by a user"""
DEFAULT_DOMAIN = 'cloud.getdbt.com'

@property
@abc.abstractmethod
Expand Down
5 changes: 4 additions & 1 deletion dbtc/client/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ def __init__(self, **kwargs):
self.session.headers = self.headers

_header_property = 'service_token'
_default_domain = 'metadata.cloud.getdbt.com'
_path = '/graphql'

@property
def _base_url(self):
return f'https://metadata.{self._host}{self._path}'

@property
def _endpoint(self) -> HTTPEndpoint:
return HTTPEndpoint(self.full_url(), self.headers)
Expand Down
5 changes: 5 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [0.4.2] - 2023-04-03

### Fixed
- How the base URL was constructed as it was not properly accounting for other regions, single tenant instances properly

## [0.4.1] - 2023-04-02

### Added
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "dbtc"
version = "0.4.1"
version = "0.4.2"
description = "An unaffiliated python wrapper for dbt Cloud APIs"
authors = ["Doug Guthrie <douglas.p.guthrie@gmail.com>"]
documentation = "https://dbtc.dpguthrie.com"
Expand Down

0 comments on commit eaddd47

Please sign in to comment.