Skip to content

Commit

Permalink
feat(ingest/mode): add option to exclude restricted (#11081)
Browse files Browse the repository at this point in the history
  • Loading branch information
anshbansal authored Aug 2, 2024
1 parent f78b6c0 commit f2e461e
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions metadata-ingestion/src/datahub/ingestion/source/mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,14 @@ class ModeConfig(StatefulIngestionConfigBase, DatasetLineageProviderConfigBase):
connect_uri: str = Field(
default="https://app.mode.com", description="Mode host URL."
)
token: str = Field(description="Mode user token.")
token: str = Field(
description="When creating workspace API key this is the 'Key ID'."
)
password: pydantic.SecretStr = Field(
description="Mode password for authentication."
description="When creating workspace API key this is the 'Secret'."
)
exclude_restricted: bool = Field(
default=False, description="Exclude restricted collections"
)

workspace: str = Field(
Expand Down Expand Up @@ -522,6 +527,16 @@ def _get_space_name_and_tokens(self) -> dict:
for s in spaces:
logger.debug(f"Space: {s.get('name')}")
space_name = s.get("name", "")
# Using both restricted and default_access_level because
# there is a current bug with restricted returning False everytime
# which has been reported to Mode team
if self.config.exclude_restricted and (
s.get("restricted") or s.get("default_access_level") == "restricted"
):
logging.debug(
f"Skipping space {space_name} due to exclude restricted"
)
continue
if not self.config.space_pattern.allowed(space_name):
self.report.report_dropped_space(space_name)
logging.debug(f"Skipping space {space_name} due to space pattern")
Expand Down

0 comments on commit f2e461e

Please sign in to comment.