Skip to content

Commit

Permalink
unprivate
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-gbloom committed Nov 27, 2024
1 parent 1413b8b commit 3ae819a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
)
Expand All @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions src/snowflake/cli/_plugins/streamlit/streamlit_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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_:
Expand Down
4 changes: 4 additions & 0 deletions src/snowflake/cli/api/entities/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
"""
Expand Down

0 comments on commit 3ae819a

Please sign in to comment.