Commit b9878d0
fix(snowflake): SHOW ... LIKE instead of INFORMATION_SCHEMA for least-privilege roles
Eric's testing surfaced that least-privilege Snowflake roles (e.g.
DAGSTER_RUNNER with USAGE on the database but not full ACCOUNTADMIN)
can hit "does not exist or not authorized" errors on
INFORMATION_SCHEMA views even when SHOW commands work fine on the
same objects. This is a documented Snowflake quirk affecting new-feature
INFORMATION_SCHEMA views specifically.
Fix: in the materialize-time metadata-read blocks (after the actual
work — REFRESH / EXECUTE / ALTER — has succeeded), swap
INFORMATION_SCHEMA queries to SHOW ... LIKE '<name>' IN SCHEMA
<db>.<schema>. Wrap each in try/except so the action still wins even
if the SHOW also fails.
Updated in snowflake_workspace/component.py:
- _dynamic_table_asset: INFORMATION_SCHEMA.DYNAMIC_TABLES → SHOW
DYNAMIC TABLES LIKE (refresh_mode, scheduling_state, target_lag,
rows, bytes)
- _task_asset: added SHOW TASKS LIKE (state, schedule, warehouse,
owner) + TASK_HISTORY wrapped in try/except
- _snowpipe_asset: added SHOW PIPES LIKE (owner, notification_channel,
definition) + SYSTEM$PIPE_STATUS wrapped + COPY_HISTORY wrapped
- _mv_asset: INFORMATION_SCHEMA.TABLES → SHOW MATERIALIZED VIEWS LIKE
(rows, bytes, cluster_by, behind_by, invalid, owner)
- _external_table_asset: INFORMATION_SCHEMA.TABLES → SHOW EXTERNAL
TABLES LIKE (rows, location, file_format_name, last_refreshed_on)
- _alert_asset: added SHOW ALERTS LIKE (state, schedule) +
ALERT_HISTORY wrapped in try/except
- observation sensor: DYNAMIC_TABLES → SHOW DYNAMIC TABLES LIKE
Updated in Wave 3 single-entity components:
- snowflake_dynamic_table_refresh_asset: same DYNAMIC_TABLES → SHOW
pattern
- snowflake_task_execute_asset: added SHOW TASKS LIKE + TASK_HISTORY
wrapped in try/except
- snowflake_task_completion_sensor: improved skip_reason error
message to point at MONITOR grant as the likely fix
Rationale per Eric's diagnosis: "SHOW only requires USAGE on the
schema + any privilege on the DT, which is what least-privilege roles
typically have. INFORMATION_SCHEMA.DYNAMIC_TABLES, by contrast, can
be invisible to scoped roles on some Snowflake accounts (account-level
policy) even with USAGE on the database — Snowflake reports the view
as 'does not exist or not authorized'."
The action (REFRESH / EXECUTE / ALTER) is what the customer actually
wants done; metadata enrichment is best-effort. Even if both SHOW and
INFORMATION_SCHEMA reads fail, the asset still materializes with the
basic metadata (name, database, schema) and a clear log warning about
the missing enrichment.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 601beef commit b9878d0
5 files changed
Lines changed: 379 additions & 7244 deletions
File tree
- assets/data-warehouse
- snowflake_dynamic_table_refresh_asset
- snowflake_task_execute_asset
- integrations/snowflake_workspace
- sensors/snowflake_task_completion_sensor
Lines changed: 29 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | 123 | | |
135 | 124 | | |
136 | 125 | | |
137 | 126 | | |
138 | 127 | | |
139 | 128 | | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
151 | 158 | | |
152 | 159 | | |
153 | 160 | | |
| |||
Lines changed: 55 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | 126 | | |
142 | 127 | | |
143 | 128 | | |
144 | 129 | | |
145 | 130 | | |
146 | 131 | | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
158 | 187 | | |
159 | 188 | | |
160 | 189 | | |
| |||
0 commit comments