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

there was an issue deleting the selected datasets #24794

Closed
3 tasks done
sebastianliebscher opened this issue Jul 25, 2023 · 3 comments
Closed
3 tasks done

there was an issue deleting the selected datasets #24794

sebastianliebscher opened this issue Jul 25, 2023 · 3 comments

Comments

@sebastianliebscher
Copy link
Contributor

sebastianliebscher commented Jul 25, 2023

Trying to bulk delete (example) datasets raises There was an issue deleting the selected datasets: Fatal error, but the datasets have actually been deleted.

How to reproduce the bug

  1. TAG=2.1.1rc2 docker-compose up
  2. wait for example datasets being loaded
  3. Go to Dashboards and successfully bulk delete all dashboards
  4. Go to Charts and successfully bulk delete all charts
  5. Go to Datasets and try to bulk delete all datasets
  6. See error
  7. the datasets have actually been deleted

Expected results

Successfully delete all datasets via bulk select (=bulk delete) without the error message.

Actual results

docker-compose log

superset_app          | 172.18.0.1 - - [25/Jul/2023:10:32:41 +0000] "DELETE /api/v1/chart/?q=!(57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33) HTTP/1.1" 200 32 "http://0.0.0.0:8088/chart/list/?pageIndex=0&sortColumn=changed_on_delta_humanized&sortOrder=desc&viewMode=table" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
superset_app          | 172.18.0.1 - - [25/Jul/2023:10:32:41 +0000] "GET /api/v1/chart/?q=(order_column:changed_on_delta_humanized,order_direction:desc,page:0,page_size:25) HTTP/1.1" 200 1348 "http://0.0.0.0:8088/chart/list/?pageIndex=0&sortColumn=changed_on_delta_humanized&sortOrder=desc&viewMode=table" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
superset_app          | 172.18.0.1 - - [25/Jul/2023:10:32:41 +0000] "GET /api/v1/chart/favorite_status/?q=!(32,31) HTTP/1.1" 200 61 "http://0.0.0.0:8088/chart/list/?pageIndex=0&sortColumn=changed_on_delta_humanized&sortOrder=desc&viewMode=table" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
superset_app          | 127.0.0.1 - - [25/Jul/2023:10:32:44 +0000] "GET /health HTTP/1.1" 200 2 "-" "curl/7.88.1"
superset_app          | 172.18.0.1 - - [25/Jul/2023:10:32:45 +0000] "DELETE /api/v1/chart/?q=!(32,31) HTTP/1.1" 200 31 "http://0.0.0.0:8088/chart/list/?pageIndex=0&sortColumn=changed_on_delta_humanized&sortOrder=desc&viewMode=table" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
superset_app          | 172.18.0.1 - - [25/Jul/2023:10:32:45 +0000] "GET /api/v1/chart/?q=(order_column:changed_on_delta_humanized,order_direction:desc,page:0,page_size:25) HTTP/1.1" 200 668 "http://0.0.0.0:8088/chart/list/?pageIndex=0&sortColumn=changed_on_delta_humanized&sortOrder=desc&viewMode=table" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
superset_app          | 172.18.0.1 - - [25/Jul/2023:10:32:46 +0000] "GET /api/v1/dataset/_info?q=(keys:!(permissions)) HTTP/1.1" 200 98 "http://0.0.0.0:8088/tablemodelview/list/?pageIndex=0&sortColumn=changed_on_delta_humanized&sortOrder=desc" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
superset_app          | 172.18.0.1 - - [25/Jul/2023:10:32:46 +0000] "GET /api/v1/dataset/?q=(order_column:changed_on_delta_humanized,order_direction:desc,page:0,page_size:25) HTTP/1.1" 200 7023 "http://0.0.0.0:8088/tablemodelview/list/?pageIndex=0&sortColumn=changed_on_delta_humanized&sortOrder=desc" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
superset_app          | 172.18.0.1 - - [25/Jul/2023:10:32:47 +0000] "POST /superset/log/?explode=events&dashboard_id=10 HTTP/1.1" 200 20 "http://0.0.0.0:8088/tablemodelview/list/?pageIndex=0&sortColumn=changed_on_delta_humanized&sortOrder=desc" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
superset_app          | 2023-07-25 10:32:55,473:ERROR:flask_appbuilder.api:Parent instance <SqlaTable at 0x7f9704082d30> is not bound to a Session; lazy load operation of attribute 'database' cannot proceed (Background on this error at: https://sqlalche.me/e/14/bhk3)
superset_app          | Traceback (most recent call last):
superset_app          |   File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/api/__init__.py", line 110, in wraps
superset_app          |     return f(self, *args, **kwargs)
superset_app          |   File "/app/superset/views/base_api.py", line 122, in wraps
superset_app          |     raise ex
superset_app          |   File "/app/superset/views/base_api.py", line 113, in wraps
superset_app          |     duration, response = time_function(f, self, *args, **kwargs)
superset_app          |   File "/app/superset/utils/core.py", line 1594, in time_function
superset_app          |     response = func(*args, **kwargs)
superset_app          |   File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/api/__init__.py", line 182, in wraps
superset_app          |     return f(self, *args, **kwargs)
superset_app          |   File "/app/superset/utils/log.py", line 266, in wrapper
superset_app          |     value = f(*args, **kwargs)
superset_app          |   File "/app/superset/datasets/api.py", line 775, in bulk_delete
superset_app          |     BulkDeleteDatasetCommand(item_ids).run()
superset_app          |   File "/app/superset/datasets/commands/bulk_delete.py", line 49, in run
superset_app          |     security_manager.find_view_menu(model.get_perm()) if model else None
superset_app          |   File "/app/superset/connectors/sqla/models.py", line 719, in get_perm
superset_app          |     if self.database is None:
superset_app          |   File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/attributes.py", line 481, in __get__
superset_app          |     return self.impl.get(state, dict_)
superset_app          |   File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/attributes.py", line 941, in get
superset_app          |     value = self._fire_loader_callables(state, key, passive)
superset_app          |   File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/attributes.py", line 977, in _fire_loader_callables
superset_app          |     return self.callable_(state, passive)
superset_app          |   File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/strategies.py", line 862, in _load_for_state
superset_app          |     raise orm_exc.DetachedInstanceError(
superset_app          | sqlalchemy.orm.exc.DetachedInstanceError: Parent instance <SqlaTable at 0x7f9704082d30> is not bound to a Session; lazy load operation of attribute 'database' cannot proceed (Background on this error at: https://sqlalche.me/e/14/bhk3)
superset_app          | 172.18.0.1 - - [25/Jul/2023:10:32:55 +0000] "DELETE /api/v1/dataset/?q=!(23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,2,1,7,6,5,4,3) HTTP/1.1" 500 26 "http://0.0.0.0:8088/tablemodelview/list/?pageIndex=0&sortColumn=changed_on_delta_humanized&sortOrder=desc" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
superset_app          | 172.18.0.1 - - [25/Jul/2023:10:32:55 +0000] "GET /static/assets/6abe473e8ad84b72d7f9.chunk.js HTTP/1.1" 200 829 "http://0.0.0.0:8088/tablemodelview/list/?pageIndex=0&sortColumn=changed_on_delta_humanized&sortOrder=desc" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"

Screenshots

image

Environment

  • browser type and version: Chromium 114
  • superset version: 2.1.0 and 2.1.1rc2
  • no issues on master

Checklist

  • 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.
@michael-s-molina
Copy link
Member

@eschutho I can't reproduce the error on master so the fix is already merged but I don't know which PR. I'm not sure how easy it is to cherry pick it into 2.1.1. If it's hard, the fix will be available in 3.0.

@eschutho
Copy link
Member

Maybe we can try to git bisect to see where the fix was and try to patch it into 2.1.2, although I agree that 3.0 will most likely be released first.

@eschutho eschutho added the v2.1 label Jul 25, 2023
@eschutho
Copy link
Member

eschutho commented Oct 4, 2023

I think the fix was in #24488, which means being a migration, I won't be able to pull this into 2.1.2, but I'll close this ticket since it's fixed in the master branch and in 3.0.

@eschutho eschutho closed this as completed Oct 4, 2023
@eschutho eschutho removed the v2.1 label Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants