A clear and concise description of what the bug is.
How to reproduce the bug
- Go to 'SQL Lab'
- Click on 'Saved queries'
- No items in the list
Expected results
Show the list of all saved queries despite of creators
Actual results
Only queries created by the current user can be shown in the list
Screenshots
Environment
(please complete the following information):
- browser type and version: chrome on win11
- superset version:
commit 16654034849505109b638fd2a784dfb377238a0e
- python version:
3.8.12
- node.js version:
none
- any feature flags active:
Checklist
Make sure to follow these steps before submitting your issue - thank you!
- [*] I have checked the superset logs for python stacktraces and included it here as text if there are any.
- [*] I have reproduced the issue with at least the latest released version of superset.
- [*] I have checked the issue tracker for the same issue and I haven't found one similar.
Additional context
My superset runs on a docker container by docker-compose.
Comment From: emilija-omnisend
Hello. Any news? We're trying to track our table references in Superset and this is the only part left.
Comment From: pengwk
This can temporarily solve the problem @emilija-omnisend @winglight
diff --git a/superset/queries/saved_queries/filters.py b/superset/queries/saved_queries/filters.py
index c53ff5619..a8efae4a8 100644
--- a/superset/queries/saved_queries/filters.py
+++ b/superset/queries/saved_queries/filters.py
@@ -22,6 +22,7 @@ from flask_sqlalchemy import BaseQuery
from sqlalchemy import or_
from sqlalchemy.orm.query import Query
+from superset import security_manager
from superset.models.sql_lab import SavedQuery
from superset.views.base import BaseFilter
from superset.views.base_api import BaseFavoriteFilter
@@ -65,6 +66,8 @@ class SavedQueryFilter(BaseFilter): # pylint: disable=too-few-public-methods
:returns: flask-sqlalchemy query
"""
- return query.filter(
- SavedQuery.created_by == g.user # pylint: disable=comparison-with-callable
- )
+ if not security_manager.can_access_all_queries():
+ query = query.filter(
+ SavedQuery.created_by == g.user # pylint: disable=comparison-with-callable
+ )
+ return query
Comment From: Bill0412
I think this should be merged, otherwise the share link functionality is meaningless.
Comment From: eschutho
We are planning to add UUID query lookup support in the near future to fix this problem. There should be a fix in 3.0.
Comment From: rusackas
@eschutho do you know if that work transpired and this was just never closed?
Comment From: jpardocimo
@eschutho do you know if that work transpired and this was just never closed?
I'm looking for this solution. I have other users that have Admin Role and they can't see the saved queries.
Comment From: tiagobmarinho
To bypass this problem (or unimplemented feature), I did the following:
- The owner of the SQL query copies the query's link by clicking on "Copy query URL," which appears under "Action" on the right side of the query in "Saved Queries."
- Another admin opens the link and clicks on "Save" when the query opens in SQL Lab.
- Click "Save as new" when the save toolbar appears.
Done! Now, the other admin will have the same query (query, description, name) saved to their account. This isn’t the best method, as if one admin edits the query, it won’t be updated for others. However, until this feature is implemented, I believe it's a workaround to transfer SQL queries between admins.
I hope this function will be implemented someday, as Superset’s ability to transfer/backup dashboards and charts is quite good compared to other open-source BI tools.
Comment From: eschutho
@eschutho do you know if that work transpired and this was just never closed?
@rusackas No we haven't had a chance to work on this. I think we should try to get the proposed PR merged instead.
Comment From: rusackas
Is anyone here willing to open the proposed PR? If not, this will likely be closed soon as stale/inactive/not-planned.
Comment From: SamraHanifCareem
We are planning to work on implementing this workflow. Similar to what we have for datasets and other screen. There should be multiple owners for each query; able to make updated