Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ingest/snowflake): Add feature flag for view defintions #10914

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ class SnowflakeV2Config(
description="If enabled, populates the snowflake usage statistics. Requires appropriate grants given to the role.",
)

include_view_definitions: bool = Field(
default=True,
description="If enabled, populates the ingested views' definitions.",
)
ethan-cartwright marked this conversation as resolved.
Show resolved Hide resolved

include_technical_schema: bool = Field(
default=True,
description="If enabled, populates the snowflake technical schema and descriptions.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,9 @@ def get_tables_for_schema(
return tables

@serialized_lru_cache(maxsize=1)
def get_views_for_database(self, db_name: str) -> Dict[str, List[SnowflakeView]]:
def get_views_for_database(
self, db_name: str, include_view_definitions: bool
) -> Dict[str, List[SnowflakeView]]:
page_limit = SHOW_VIEWS_MAX_PAGE_SIZE

views: Dict[str, List[SnowflakeView]] = {}
Expand Down Expand Up @@ -353,7 +355,9 @@ def get_views_for_database(self, db_name: str) -> Dict[str, List[SnowflakeView]]
created=view["created_on"],
# last_altered=table["last_altered"],
comment=view["comment"],
view_definition=view["text"],
view_definition=(
view["text"] if include_view_definitions else None
),
last_altered=view["created_on"],
materialized=(
view.get("is_materialized", "false").lower() == "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,9 @@ def get_tables_for_schema(
def get_views_for_schema(
self, schema_name: str, db_name: str
) -> List[SnowflakeView]:
views = self.data_dictionary.get_views_for_database(db_name)
views = self.data_dictionary.get_views_for_database(
db_name, self.config.include_view_definitions
)

# Some schema may not have any table
return views.get(schema_name, [])
Expand Down
Loading