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 2019/07/03 20:45:08 UTC

[GitHub] [incubator-superset] john-bodley commented on a change in pull request #5449: [schema] Updating the tables schema

john-bodley commented on a change in pull request #5449: [schema] Updating the tables schema
URL: https://github.com/apache/incubator-superset/pull/5449#discussion_r300147133
 
 

 ##########
 File path: superset/connectors/sqla/views.py
 ##########
 @@ -348,14 +353,7 @@ class TableModelView(DatasourceModelView, DeleteMixin, YamlExportMixin):  # noqa
     }
 
     def pre_add(self, table):
-        with db.session.no_autoflush:
-            table_query = db.session.query(models.SqlaTable).filter(
-                models.SqlaTable.table_name == table.table_name,
-                models.SqlaTable.schema == table.schema,
-                models.SqlaTable.database_id == table.database.id,
-            )
-            if db.session.query(table_query.exists()).scalar():
-                raise Exception(get_datasource_exist_error_msg(table.full_name))
+        models.SqlaTable.before_insert(None, None, table)
 
 Review comment:
   Adding this fixes flashing the `General Error <class.Exception>` with the correct message on insert though overriding the `pre_update` method didn't see to remedy the issue (uncaught exception) when updating.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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