-
Notifications
You must be signed in to change notification settings - Fork 59
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
Add grants support to Streamlit entity #1981
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,6 +141,23 @@ def get_imports_sql(self) -> str | None: | |
return f"IMPORTS = ({imports})" | ||
|
||
|
||
class Grant(UpdatableModel): | ||
privilege: str = Field(title="Required privileges") | ||
role: str = Field(title="Role to which the privileges will be granted") | ||
|
||
def get_grant_sql(self, entity_model: EntityModelBase) -> str: | ||
return f"GRANT {self.privilege} ON {entity_model.get_type().upper()} {entity_model.fqn.sql_identifier} TO ROLE {self.role}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In relation to my PR #1967 , will this allow the ability to grant share privileges on a Streamlit app? It appears Streamlit uses |
||
|
||
|
||
class GrantBaseModel(UpdatableModel): | ||
grants: Optional[List[Grant]] = Field(title="List of grants", default=None) | ||
|
||
def get_grant_sqls(self) -> list[str]: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should add this to |
||
return ( | ||
[grant.get_grant_sql(self) for grant in self.grants] if self.grants else [] | ||
) | ||
|
||
|
||
class ExternalAccessBaseModel: | ||
external_access_integrations: Optional[List[str]] = Field( | ||
title="Names of external access integrations needed for this entity to access external networks", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small improvement: execute all grants in single query