fix(pkg-py): gracefully handle Snowflake semantic view discovery errors#220
Merged
fix(pkg-py): gracefully handle Snowflake semantic view discovery errors#220
Conversation
When querychat connects to a Snowflake database that has semantic views but the current role lacks permission to query them (e.g., GET_DDL on a semantic view), the raw SQL call raises a ProgrammingError that propagates up and crashes the Shiny app on startup. Wrap the two SQL execution points in discover_semantic_views() and get_semantic_view_ddl() with try/except so that permission errors (or any other SQL failures) are logged as warnings with full tracebacks instead of crashing the app. The app gracefully degrades to running without semantic view context in the system prompt. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
SHOW SEMANTIC VIEWS,GET_DDL('SEMANTIC_VIEW', ...)) crashes the Shiny app on startup when the current Snowflake role lacks permission to run those queries. This is easy to hit in practice — semantic views may exist in a schema but the user's role may not have theUSAGEorOWNERSHIPprivilege needed to inspect them.execute_raw_sql()call sites indiscover_semantic_views()andget_semantic_view_ddl()with try/except. On failure, a warning with the full traceback is logged to the console and the app continues without semantic view context in the system prompt.