feat(streamlit): resolve STREAMLIT grants at plan time (fetch_streamlit)#24
Open
usbrandon wants to merge 1 commit into
Open
feat(streamlit): resolve STREAMLIT grants at plan time (fetch_streamlit)#24usbrandon wants to merge 1 commit into
usbrandon wants to merge 1 commit into
Conversation
STREAMLIT was a supported schema-scoped resource for rendering grant SQL,
but `snowcap plan` errored when a grant referenced a streamlit object:
module 'snowcap.data_provider' has no attribute 'fetch_streamlit'
Because Streamlit has a concrete resource class (unlike CORTEX SEARCH SERVICE,
which is SchemaScope-only), resolving a `on: streamlit <db>.<schema>.<app>`
grant reference drives fetch_resource -> fetch_streamlit, which didn't exist.
This adds it so grants on streamlit apps can be planned and applied:
grants:
- priv: USAGE
on: streamlit <db>.<schema>.<app>
to: <viewer_role>
- snowcap/data_provider.py: fetch_streamlit() — SHOW STREAMLITS + DESC
STREAMLIT, mapping root_location -> from_, plus main_file / title /
query_warehouse / comment / owner (mirrors fetch_notebook).
- tests/test_grant.py: test_grant_on_streamlit (USAGE renders correctly).
- tests/test_privs.py: TestStreamlitPriv (enum values).
- docs/resources/streamlit.md: "Granting access" section.
- docs/resources/grant.md: streamlit example in the Object Grants block.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016L3b4GTh5nyFy5vxQ6e9TY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
snowcap planerrors whenever a grant references a Streamlit app:StreamlitPriv,SchemaPriv.CREATE_STREAMLIT, and theStreamlitresource class already exist, so grant SQL renders — but because Streamlit has a concrete resource class, resolvingon: streamlit <db>.<schema>.<app>drivesfetch_resource→fetch_streamlit, which is missing.Change
snowcap/data_provider.py: addfetch_streamlit()—SHOW STREAMLITS+DESC STREAMLIT, mappingroot_location→from_, plusmain_file/title/query_warehouse/comment/owner(mirrorsfetch_notebook).tests/test_grant.py:test_grant_on_streamlit.tests/test_privs.py:TestStreamlitPriv.docs/resources/streamlit.md: "Granting access" section;docs/resources/grant.md: streamlit example.Validation
Verified end-to-end against a live account:
GRANT USAGE ON STREAMLITnow plans and applies (the previously-fatal fetch error is gone; the grant shows as a normal create). Full unit suite green.🤖 Generated with Claude Code