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/06/13 18:49:45 UTC

[GitHub] john-bodley closed pull request #5179: [Tests] Adding column to test data only if it doesn't already exist

john-bodley closed pull request #5179: [Tests] Adding column to test data only if it doesn't already exist
URL: https://github.com/apache/incubator-superset/pull/5179
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/superset/data/__init__.py b/superset/data/__init__.py
index 4f79be842a..7bae20bae9 100644
--- a/superset/data/__init__.py
+++ b/superset/data/__init__.py
@@ -586,10 +586,13 @@ def load_birth_names():
     obj.main_dttm_col = 'ds'
     obj.database = utils.get_or_create_main_db()
     obj.filter_select_enabled = True
-    obj.columns.append(TableColumn(
-        column_name='num_california',
-        expression="CASE WHEN state = 'CA' THEN num ELSE 0 END"
-    ))
+
+    if not any(col.column_name == 'num_california' for col in obj.columns):
+        obj.columns.append(TableColumn(
+            column_name='num_california',
+            expression="CASE WHEN state = 'CA' THEN num ELSE 0 END"
+        ))
+
     db.session.merge(obj)
     db.session.commit()
     obj.fetch_metadata()


 

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