From 3ae819a5ee3fb4ccb95318a50bf5c27d52e820f1 Mon Sep 17 00:00:00 2001 From: Guy Bloom Date: Wed, 27 Nov 2024 13:50:45 -0500 Subject: [PATCH] unprivate --- .../cli/_plugins/nativeapp/entities/application_package.py | 6 +++--- src/snowflake/cli/_plugins/streamlit/streamlit_entity.py | 6 +++--- src/snowflake/cli/api/entities/common.py | 4 ++++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/snowflake/cli/_plugins/nativeapp/entities/application_package.py b/src/snowflake/cli/_plugins/nativeapp/entities/application_package.py index 6e8783c3c5..faaa61c735 100644 --- a/src/snowflake/cli/_plugins/nativeapp/entities/application_package.py +++ b/src/snowflake/cli/_plugins/nativeapp/entities/application_package.py @@ -600,11 +600,11 @@ def _bundle(self, action_ctx: ActionContext = None): child_artifacts_dir = entities_dir / child.target os.makedirs(child_artifacts_dir) child_entity = action_ctx.get_entity(child.target) - child_entity._bundle(child_artifacts_dir) # noqa: SLF001 + child_entity.bundle(child_artifacts_dir) app_role = child.application_role child_schema = child.schema_ children_sql.append( - child_entity._get_deploy_sql( # noqa: SLF001 + child_entity.get_deploy_sql( schema=child_schema, from_=Path("_entities", child.target) ) ) @@ -618,7 +618,7 @@ def _bundle(self, action_ctx: ActionContext = None): ) if isinstance(child_entity, StreamlitEntity) and app_role: children_sql.append( - f"GRANT USAGE ON STREAMLIT {child_schema}.{child_entity._entity_model.entity_id} TO APPLICATION ROLE {app_role};" # noqa: SLF001 + f"GRANT USAGE ON STREAMLIT {child_schema}.{child_entity.entity_id} TO APPLICATION ROLE {app_role};" ) bundle_context = BundleContext( diff --git a/src/snowflake/cli/_plugins/streamlit/streamlit_entity.py b/src/snowflake/cli/_plugins/streamlit/streamlit_entity.py index ae311d3711..b594e1ccb2 100644 --- a/src/snowflake/cli/_plugins/streamlit/streamlit_entity.py +++ b/src/snowflake/cli/_plugins/streamlit/streamlit_entity.py @@ -29,9 +29,9 @@ def action_bundle( *args, **kwargs, ): - return self._bundle() + return self.bundle() - def _bundle(self, bundle_root=None): + def bundle(self, bundle_root=None): return build_bundle( self.project_root, bundle_root or self.deploy_root, @@ -41,7 +41,7 @@ def _bundle(self, bundle_root=None): ], ) - def _get_deploy_sql( + def get_deploy_sql( self, schema: Optional[str] = None, from_: Optional[Path] = None ): if from_: diff --git a/src/snowflake/cli/api/entities/common.py b/src/snowflake/cli/api/entities/common.py index 021830fcb2..7c39a66e73 100644 --- a/src/snowflake/cli/api/entities/common.py +++ b/src/snowflake/cli/api/entities/common.py @@ -55,6 +55,10 @@ def __init__(self, entity_model: T, workspace_ctx: WorkspaceContext): self._entity_model = entity_model self._workspace_ctx = workspace_ctx + @property + def entity_id(self): + return self._entity_model.entity_id + @classmethod def get_entity_model_type(cls) -> Type[T]: """