superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From johnbod...@apache.org
Subject [incubator-superset] branch master updated: [main] Disable resetting main DB attributes (#6845)
Date Thu, 14 Feb 2019 00:41:24 GMT
This is an automated email from the ASF dual-hosted git repository.

johnbodley pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 60d5f89  [main] Disable resetting main DB attributes (#6845)
60d5f89 is described below

commit 60d5f89faaa6e76fdfb87d3ba8d76766d268a43f
Author: John Bodley <4567245+john-bodley@users.noreply.github.com>
AuthorDate: Wed Feb 13 16:41:16 2019 -0800

    [main] Disable resetting main DB attributes (#6845)
---
 superset/utils/core.py | 8 +++++---
 tests/core_tests.py    | 5 ++---
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/superset/utils/core.py b/superset/utils/core.py
index efeff7e..0edd6e5 100644
--- a/superset/utils/core.py
+++ b/superset/utils/core.py
@@ -865,10 +865,12 @@ def get_or_create_main_db():
     logging.info('Creating database reference')
     dbobj = get_main_database(db.session)
     if not dbobj:
-        dbobj = models.Database(database_name='main')
+        dbobj = models.Database(
+            database_name='main',
+            allow_csv_upload=True,
+            expose_in_sqllab=True,
+        )
     dbobj.set_sqlalchemy_uri(conf.get('SQLALCHEMY_DATABASE_URI'))
-    dbobj.expose_in_sqllab = True
-    dbobj.allow_csv_upload = True
     db.session.add(dbobj)
     db.session.commit()
     return dbobj
diff --git a/tests/core_tests.py b/tests/core_tests.py
index 9b8983a..326025e 100644
--- a/tests/core_tests.py
+++ b/tests/core_tests.py
@@ -646,15 +646,14 @@ class CoreTests(SupersetTestCase):
         main_db_uri = (
             db.session.query(models.Database)
             .filter_by(database_name='main')
-            .all()
+            .one()
         )
-
         test_file = open(filename, 'rb')
         form_data = {
             'csv_file': test_file,
             'sep': ',',
             'name': table_name,
-            'con': main_db_uri[0].id,
+            'con': main_db_uri.id,
             'if_exists': 'append',
             'index_label': 'test_label',
             'mangle_dupe_cols': False,


Mime
View raw message