You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2018/08/28 01:48:04 UTC

[GitHub] betodealmeida commented on a change in pull request #5749: Prevent deleting databases that have attached tables

betodealmeida commented on a change in pull request #5749: Prevent deleting databases that have attached tables
URL: https://github.com/apache/incubator-superset/pull/5749#discussion_r213164001
 
 

 ##########
 File path: superset/views/core.py
 ##########
 @@ -256,6 +256,13 @@ def pre_add(self, db):
     def pre_update(self, db):
         self.pre_add(db)
 
+    def pre_delete(self, obj):
+        if obj.tables:
+            raise SupersetException(Markup(
+                'Cannot delete a database that has tables attached. '
+                "Here's the list of associated tables: " +
+                ''.join(['{}'.format(o) for o in obj.tables])))
 
 Review comment:
   You want to join them with a comma here, no? Also, you don't need format nor the list comprehension:
   
   ```python
   ', '.join(str(o) for o in obj.tables)))
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org