Skip to content

Commit

Permalink
Fix logic around cloud_mode and ge_cloud_mode. (#6550)
Browse files Browse the repository at this point in the history
  • Loading branch information
billdirks authored Dec 10, 2022
1 parent 5a38817 commit 24fb805
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,8 @@ def __init__(
None
"""
# Chetan - 20221208 - not formally deprecating these values until a future date
if cloud_config is not None or ge_cloud_config is not None:
cloud_config = cloud_config or ge_cloud_config
if cloud_mode is not False or ge_cloud_mode is not False:
cloud_mode = cloud_mode or ge_cloud_mode
cloud_config = cloud_config if cloud_config is not None else ge_cloud_config
cloud_mode = True if cloud_mode or ge_cloud_mode else False

project_data_context_config: DataContextConfig = (
BaseDataContext.get_or_create_data_context_config(project_config)
Expand Down
19 changes: 13 additions & 6 deletions great_expectations/data_context/data_context/cloud_data_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,19 @@ def __init__(
self._cloud_mode = True # property needed for backward compatibility

# Chetan - 20221208 - not formally deprecating these values until a future date
if cloud_base_url is not None or ge_cloud_base_url is not None:
cloud_base_url = cloud_base_url or ge_cloud_base_url
if cloud_access_token is not None or ge_cloud_access_token is not None:
cloud_access_token = cloud_access_token or ge_cloud_access_token
if cloud_organization_id is not None or ge_cloud_organization_id is not None:
cloud_organization_id = cloud_organization_id or ge_cloud_organization_id
cloud_base_url = (
cloud_base_url if cloud_base_url is not None else ge_cloud_base_url
)
cloud_access_token = (
cloud_access_token
if cloud_access_token is not None
else ge_cloud_access_token
)
cloud_organization_id = (
cloud_organization_id
if cloud_organization_id is not None
else ge_cloud_organization_id
)

self._cloud_config = self.get_cloud_config(
cloud_base_url=cloud_base_url,
Expand Down
22 changes: 14 additions & 8 deletions great_expectations/data_context/data_context/data_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,20 @@ def __init__(
ge_cloud_organization_id: Optional[str] = None,
) -> None:
# Chetan - 20221208 - not formally deprecating these values until a future date
if cloud_base_url is not None or ge_cloud_base_url is not None:
cloud_base_url = cloud_base_url or ge_cloud_base_url
if cloud_access_token is not None or ge_cloud_access_token is not None:
cloud_access_token = cloud_access_token or ge_cloud_access_token
if cloud_organization_id is not None or ge_cloud_organization_id is not None:
cloud_organization_id = cloud_organization_id or ge_cloud_organization_id
if cloud_mode is not False or ge_cloud_mode is not False:
cloud_mode = cloud_mode or ge_cloud_mode
cloud_base_url = (
cloud_base_url if cloud_base_url is not None else ge_cloud_base_url
)
cloud_access_token = (
cloud_access_token
if cloud_access_token is not None
else ge_cloud_access_token
)
cloud_organization_id = (
cloud_organization_id
if cloud_organization_id is not None
else ge_cloud_organization_id
)
cloud_mode = True if cloud_mode or ge_cloud_mode else False

self._sources: _SourceFactories = _SourceFactories(self)
self._cloud_mode = cloud_mode
Expand Down
18 changes: 10 additions & 8 deletions great_expectations/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1802,14 +1802,16 @@ def get_context(
)

# Chetan - 20221208 - not formally deprecating these values until a future date
if cloud_base_url is not None or ge_cloud_base_url is not None:
cloud_base_url = cloud_base_url or ge_cloud_base_url
if cloud_access_token is not None or ge_cloud_access_token is not None:
cloud_access_token = cloud_access_token or ge_cloud_access_token
if cloud_organization_id is not None or ge_cloud_organization_id is not None:
cloud_organization_id = cloud_organization_id or ge_cloud_organization_id
if cloud_mode is not None or ge_cloud_mode is not None:
cloud_mode = cloud_mode or ge_cloud_mode
cloud_base_url = cloud_base_url if cloud_base_url is not None else ge_cloud_base_url
cloud_access_token = (
cloud_access_token if cloud_access_token is not None else ge_cloud_access_token
)
cloud_organization_id = (
cloud_organization_id
if cloud_organization_id is not None
else ge_cloud_organization_id
)
cloud_mode = cloud_mode if cloud_mode is not None else ge_cloud_mode

# First, check for ge_cloud conditions

Expand Down

0 comments on commit 24fb805

Please sign in to comment.