GitHub user dosubot[bot] added a comment to the discussion: Question: 
Encountered "Failed to save slice" error when saving chart to dashboard

<!-- Answer -->
The "can not access the query" error in SQL Lab can be caused by a few 
different things. Here are the most common causes for Superset 4.0.1:

**1. Cross-database query syntax (most likely in 4.0.1)**

If you're using fully qualified table names like `SELECT * FROM 
database_name.schema.table`, this is a [known issue introduced in 
4.0.1](https://github.com/apache/superset/issues/31406). Superset now 
interprets the database prefix as a "catalog" and requires 
`all_database_access` or `all_datasource_access` permissions.

**Workaround:** Try removing the database prefix and using just `schema.table` 
in your query, or grant `all_database_access` to the user's role.

**2. Jinja templating issue**

If your query uses Jinja functions like `{{ filter_values() }}`, there's a 
[known bug where permission checks 
fail](https://github.com/apache/superset/issues/33579) because the Jinja 
context isn't properly initialized. This was fixed in PR #33568—check if your 
version includes that fix.

**3. Missing SQL Lab permissions**

Ensure the user's roles include these permissions on 
[TableSchemaView](https://github.com/apache/superset/issues/31882#issuecomment-2594634697):
- `can post on TableSchemaView`
- `can delete on TableSchemaView`  
- `can expand on TableSchemaView`

Could you share the exact SQL query that's failing? That will help narrow down 
which issue you're hitting.


<!-- Dosu Comment Footer -->
*To reply, just mention 
[@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=brand-link).*

---
<sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/b23ab5c6-a0c9-4e19-bd51-1a3d016715a4?feedback_type=great_response&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/b23ab5c6-a0c9-4e19-bd51-1a3d016715a4?feedback_type=irrelevant_answer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/b23ab5c6-a0c9-4e19-bd51-1a3d016715a4?feedback_type=incorrect_sources&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/b23ab5c6-a0c9-4e19-bd51-1a3d016715a4?feedback_type=too_verbose&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-too_verbose)
 | [Hallucination](https://app.dosu.dev/response-feedback/b23ab5c6-a0c9-4e
 
19-bd51-1a3d016715a4?feedback_type=hallucination&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/b23ab5c6-a0c9-4e19-bd51-1a3d016715a4?feedback_type=bug_report&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/b23ab5c6-a0c9-4e19-bd51-1a3d016715a4?feedback_type=other&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-other)</sup>

[![Chat with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=chat-badge)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=The%20%22can%20not%20access%20the%20query%22%20error%20in%20SQL%20Lab%20can%20be%20caused%20by%20a%20few%20different%20things.%20Here%20are%20the%20most%20common%20causes%20for%20Superset%204.0.1%3A%0A%0A%2A%2A1.%20Cross-database%20query%20syntax%20%28most%20likely%20in%204.0.1%29%2A%2A%0A%0AIf%20you%27re%20using%20fully%20qualified%20table%20names%20like%20%60SELECT%20%2A%20FROM%20database_name.schema.table%60%2C%20this%20is%20a%20%5Bknown%20issue%20introduced%20in%204.0.1%5D%28https%3A//github.com/apache/superset/issues/31406%29.%20Superset%20now%20interprets%20the%20database%20prefix%20as%20a%20%22catalog%22%20and%20requires%20%60all_database_access%60%20or%20%60all_datasou
 
rce_access%60%20permissions.%0A%0A%2A%2AWorkaround%3A%2A%2A%20Try%20removing%20the%20database%20prefix%20and%20using%20just%20%60schema.table%60%20in%20your%20query%2C%20or%20grant%20%60all_database_access%60%20to%20the%20user%27s%20role.%0A%0A%2A%2A2.%20Jinja%20templating%20issue%2A%2A%0A%0AIf%20your%20query%20uses%20Jinja%20functions%20like%20%60%7B%7B%20filter_values%28%29%20%7D%7D%60%2C%20there%27s%20a%20%5Bknown%20bug%20where%20permission%20checks%20fail%5D%28https%3A//github.com/apache/superset/issues/33579%29%20because%20the%20Jinja%20context%20isn%27t%20properly%20initialized.%20This%20was%20fixed%20in%20PR%20%2333568%E2%80%94check%20if%20your%20version%20includes%20that%20fix.%0A%0A%2A%2A3.%20Missing%20SQL%20Lab%20permissions%2A%2A%0A%0AEnsure%20the%20user%27s%20roles%20include%20these%20permissions%20on%20%5BTableSchemaView%5D%28https%3A//github.com/apache/superset/issues/31882%23issuecomment-2594634697%29%3A%0A-%20%60can%20post%20on%20TableSchemaView%60%0A-%20%60can%20del
 
ete%20on%20TableSchemaView%60%20%20%0A-%20%60can%20expand%20on%20TableSchemaView%60%0A%0ACould%20you%20share%20the%20exact%20SQL%20query%20that%27s%20failing%3F%20That%20will%20help%20narrow%20down%20which%20issue%20you%27re%20hitting.)&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=join-discord)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/38618)

GitHub link: 
https://github.com/apache/superset/discussions/38618#discussioncomment-16127905

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to