Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Other admin users can't see "saved queries" created by another admin users #20604

Open
winglight opened this issue Jul 5, 2022 · 8 comments · May be fixed by #21769
Open

Other admin users can't see "saved queries" created by another admin users #20604

winglight opened this issue Jul 5, 2022 · 8 comments · May be fixed by #21769
Labels
#bug Bug report

Comments

@winglight
Copy link

A clear and concise description of what the bug is.

How to reproduce the bug

  1. Go to 'SQL Lab'
  2. Click on 'Saved queries'
  3. 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.

@winglight winglight added the #bug Bug report label Jul 5, 2022
@emilija-omnisend
Copy link

Hello. Any news? We're trying to track our table references in Superset and this is the only part left.

@pengwk
Copy link

pengwk commented Oct 11, 2022

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

@Bill0412
Copy link

I think this should be merged, otherwise the share link functionality is meaningless.

@eschutho
Copy link
Member

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.

@rusackas
Copy link
Member

rusackas commented Mar 4, 2024

@eschutho do you know if that work transpired and this was just never closed?

@jpardocimo
Copy link

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

@tiagobmarinho
Copy link

To bypass this problem (or unimplemented feature), I did the following:

  1. 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."
  2. Another admin opens the link and clicks on "Save" when the query opens in SQL Lab.
  3. 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.

@eschutho
Copy link
Member

eschutho commented Sep 7, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
#bug Bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants