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

Invalid assignment of ObjectType in saved_query list API #23610

Closed
3 tasks done
akzarma opened this issue Apr 6, 2023 · 5 comments · Fixed by #23611
Closed
3 tasks done

Invalid assignment of ObjectType in saved_query list API #23610

akzarma opened this issue Apr 6, 2023 · 5 comments · Fixed by #23611
Labels
#bug Bug report

Comments

@akzarma
Copy link
Contributor

akzarma commented Apr 6, 2023

There is wrong assignment of object_type here (it should be "query" instead of "saved_query")
Due to which, saved_query list API fails to load (when used databases except on sqlite - probably because sqlite does not strictly check enum type of object_type)

How to reproduce the bug

  1. Setup backend database as postgres, Go to 'Saved Queries' page
  2. You'll see an error popup right away and there are no saved queries shown.

Expected results

There should not be any error and saved queries should load fine

Actual results

  • Shows error popup with sql error and there is no row of saved queries.

Screenshots

Screenshot 2023-04-06 at 4 51 32 PM

Environment

(please complete the following information):

browser type and version:
superset version: 2.1.0
python version: 3.9.14
node.js version: 16.17.1
any feature flags active: TAGGING_SYSTEM

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.
@Antonio-RiveroMartnez
Copy link
Member

I tried reproducing this issue locally with latest master version and I don't get the error message.

Screen.Recording.2023-04-06.at.10.37.05.mov

@akzarma
Copy link
Contributor Author

akzarma commented Apr 6, 2023

@Antonio-RiveroMartnez what database is your local setup running on? it works fine for SQLite. I can repro it with postgres.

@Antonio-RiveroMartnez
Copy link
Member

Antonio-RiveroMartnez commented Apr 6, 2023

Yes, I am using Postgres and even my query is using it (You can verify in the video above for the selected Database). Are you using latest master or branch 2.1.0? If 2.1.0, could you try using latest master? Trying to see if it got already solved by some newer change after the 2.1.0 cut. Thanks @akzarma

@akzarma
Copy link
Contributor Author

akzarma commented Apr 6, 2023

Yeah, my bad, I was some commits behind. it seems like it got resolved in the effect of #23526
However, The fix (#23611 ) I provided is still needed for the Tag feature to work on saved queries (which I think is half baked for saved queries)
My fix assigns the right object_type ("query") from the available types instead of "saved_query".

class ObjectTypes(enum.Enum):
"""Object types."""
# pylint: disable=invalid-name
query = 1
chart = 2
dashboard = 3
dataset = 4

But yeah, this issue should be closed as the steps mentioned are not reproducing the bug.
Thanks @Antonio-RiveroMartnez

@Antonio-RiveroMartnez
Copy link
Member

Awesome! Thanks to you @akzarma , I will close this now.

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.

2 participants