Skip to content

fix(pkg-py): gracefully handle Snowflake semantic view discovery errors#220

Merged
cpsievert merged 1 commit intomainfrom
fix/graceful-semantic-view-errors
Apr 17, 2026
Merged

fix(pkg-py): gracefully handle Snowflake semantic view discovery errors#220
cpsievert merged 1 commit intomainfrom
fix/graceful-semantic-view-errors

Conversation

@cpsievert
Copy link
Copy Markdown
Contributor

@cpsievert cpsievert commented Apr 17, 2026

Summary

  • Snowflake semantic view discovery (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 the USAGE or OWNERSHIP privilege needed to inspect them.
  • Wrap the two execute_raw_sql() call sites in discover_semantic_views() and get_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.
  • Per-view DDL failures are isolated: if one view's DDL is inaccessible, the others are still discovered.

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 comment was marked as resolved.

@cpsievert cpsievert merged commit 1c241a8 into main Apr 17, 2026
11 checks passed
@cpsievert cpsievert deleted the fix/graceful-semantic-view-errors branch April 17, 2026 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants