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 04:23:12 UTC

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

mistercrunch 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_r213180652
 
 

 ##########
 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:
   Somehow I missed the coma... About `str` I've been steering away from it since in py2 it won't do unicode properly. `.format()` always work and does unicode if using the __future__ unicode literals imports.
   
   I'm surprised to see the comprehension working without the brackets, I'm guessing then it's a generator.

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