GitHub user dosubot[bot] added a comment to the discussion: Not able to run any 
SQL query on SQL lab

<!-- Greeting -->
Hi @ABDevops-test! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the 
superset team.

<!-- Answer -->
This issue is likely caused by how Superset handles impersonation for StarRocks 
connections during query execution. When running queries in SQL Lab, Superset 
may execute a pre-query like `EXECUTE AS "username" WITH NO REVERT;` if 
impersonation is enabled for the database connection. If the impersonation 
fails or the effective user lacks privileges, StarRocks returns an 
"authentication required" error, even though listing tables works (because 
metadata operations skip this step) 
[[source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/db_engine_specs/starrocks.py#L34-L250)].

Here’s a checklist to help resolve this:

1. **Check impersonation settings**: In Superset, go to your StarRocks database 
connection and see if "Impersonate the logged-in user" is enabled. If so, try 
disabling it and test query execution again.
2. **Verify user privileges**: Make sure the user specified in your connection 
string has permission to run queries and, if impersonation is enabled, that the 
impersonated user can run queries in StarRocks.
3. **Review connection string**: Confirm your connection string follows the 
format `starrocks://<User>:<Password>@<Host>:<Port>/<Catalog>.<Database>` and 
that credentials are correct 
[[source](https://github.com/apache/superset/blob/master/docs/docs/configuration/databases.mdx)].
4. **Driver compatibility**: If you installed the latest StarRocks driver, 
there may be a SQLAlchemy version conflict. Use `starrocks==1.0.6` to ensure 
compatibility with Superset 
[[source](https://github.com/apache/superset/issues/31803)].
5. **Check logs**: Look for detailed error messages in both Superset and 
StarRocks logs to pinpoint whether the failure is during the impersonation 
pre-query or the main query.

If impersonation is not needed, disabling it is often the quickest fix. If you 
need impersonation, ensure the StarRocks user has the right privileges and that 
the pre-query works when run manually. For more details, see the [StarRocks 
Superset integration 
docs](https://docs.starrocks.io/docs/integrations/BI_integrations/Superset/).


<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*

---
<sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/7b9b8638-0788-48d1-a96d-fffec4fb2c9b?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/7b9b8638-0788-48d1-a96d-fffec4fb2c9b?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/7b9b8638-0788-48d1-a96d-fffec4fb2c9b?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/7b9b8638-0788-48d1-a96d-fffec4fb2c9b?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/7b9b8638-0788-48d1-a96d-fffec4fb2c9b?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/7b9b8638-0788-48d1-a96d-fffec4fb2c9b?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/7b9b8638-0788-48d1-a96d-fffec4fb2c9b?feedback_type=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)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20issue%20is%20likely%20caused%20by%20how%20Superset%20handles%20impersonation%20for%20StarRocks%20connections%20during%20query%20execution.%20When%20running%20queries%20in%20SQL%20Lab%2C%20Superset%20may%20execute%20a%20pre-query%20like%20%60EXECUTE%20AS%20%22username%22%20WITH%20NO%20REVERT%3B%60%20if%20impersonation%20is%20enabled%20for%20the%20database%20connection.%20If%20the%20impersonation%20fails%20or%20the%20effective%20user%20lacks%20privileges%2C%20StarRocks%20returns%20an%20%22authentication%20required%22%20error%2C%20even%20though%20listing%20tables%20works%20%28because%20metadata%20operations%20skip%20this%20step%29%20%5B%5Bsource%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/db_eng
 
ine_specs/starrocks.py%23L34-L250%29%5D.%0A%0AHere%E2%80%99s%20a%20checklist%20to%20help%20resolve%20this%3A%0A%0A1.%20%2A%2ACheck%20impersonation%20settings%2A%2A%3A%20In%20Superset%2C%20go%20to%20your%20StarRocks%20database%20connection%20and%20see%20if%20%22Impersonate%20the%20logged-in%20user%22%20is%20enabled.%20If%20so%2C%20try%20disabling%20it%20and%20test%20query%20execution%20again.%0A2.%20%2A%2AVerify%20user%20privileges%2A%2A%3A%20Make%20sure%20the%20user%20specified%20in%20your%20connection%20string%20has%20permission%20to%20run%20queries%20and%2C%20if%20impersonation%20is%20enabled%2C%20that%20the%20impersonated%20user%20can%20run%20queries%20in%20StarRocks.%0A3.%20%2A%2AReview%20connection%20string%2A%2A%3A%20Confirm%20your%20connection%20string%20follows%20the%20format%20%60starrocks%3A//%3CUser%3E%3A%3CPassword%3E%40%3CHost%3E%3A%3CPort%3E/%3CCatalog%3E.%3CDatabase%3E%60%20and%20that%20credentials%20are%20correct%20%5B%5Bsource%5D%28https%3A//github.com/apache/supers
 
et/blob/master/docs/docs/configuration/databases.mdx%29%5D.%0A4.%20%2A%2ADriver%20compatibility%2A%2A%3A%20If%20you%20installed%20the%20latest%20StarRocks%20driver%2C%20there%20may%20be%20a%20SQLAlchemy%20version%20conflict.%20Use%20%60starrocks%3D%3D1.0.6%60%20to%20ensure%20compatibility%20with%20Superset%20%5B%5Bsource%5D%28https%3A//github.com/apache/superset/issues/31803%29%5D.%0A5.%20%2A%2ACheck%20logs%2A%2A%3A%20Look%20for%20detailed%20error%20messages%20in%20both%20Superset%20and%20StarRocks%20logs%20to%20pinpoint%20whether%20the%20failure%20is%20during%20the%20impersonation%20pre-query%20or%20the%20main%20query.%0A%0AIf%20impersonation%20is%20not%20needed%2C%20disabling%20it%20is%20often%20the%20quickest%20fix.%20If%20you%20need%20impersonation%2C%20ensure%20the%20StarRocks%20user%20has%20the%20right%20privileges%20and%20that%20the%20pre-query%20works%20when%20run%20manually.%20For%20more%20details%2C%20see%20the%20%5BStarRocks%20Superset%20integration%20docs%5D%28https%3A//
 
docs.starrocks.io/docs/integrations/BI_integrations/Superset/%29.)&nbsp;[![Join 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&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/issues/36482)

GitHub link: 
https://github.com/apache/superset/discussions/36710#discussioncomment-15281600

----
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