You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2019/07/22 05:47:46 UTC
[incubator-superset] branch master updated: [Bugfix] Response
header and response mismatch on explore result from sqllab (#7907)
This is an automated email from the ASF dual-hosted git repository.
villebro 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 ee3430c [Bugfix] Response header and response mismatch on explore result from sqllab (#7907)
ee3430c is described below
commit ee3430cce5ccfb073522a8388abbbdd68e1eed0b
Author: Arpit <ar...@guavus.com>
AuthorDate: Mon Jul 22 11:17:34 2019 +0530
[Bugfix] Response header and response mismatch on explore result from sqllab (#7907)
* fix(sql-lab explore): fixed response data and header type to be aligned
* fix(sql-lab explore): fixed test error caused by incorrect test at master
* fix(sql-lab explore): reformatted
* fix(sql-lab explore): removed unused import
---
superset/assets/src/SqlLab/actions/sqlLab.js | 3 +--
superset/views/core.py | 2 +-
tests/sqla_models_tests.py | 3 +--
3 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/superset/assets/src/SqlLab/actions/sqlLab.js b/superset/assets/src/SqlLab/actions/sqlLab.js
index 8172c49..94f11cc 100644
--- a/superset/assets/src/SqlLab/actions/sqlLab.js
+++ b/superset/assets/src/SqlLab/actions/sqlLab.js
@@ -530,8 +530,7 @@ export function createDatasource(vizOptions) {
endpoint: '/superset/sqllab_viz/',
postPayload: { data: vizOptions },
})
- .then(({ json }) => {
- const data = JSON.parse(json);
+ .then(({ data }) => {
dispatch(createDatasourceSuccess(data));
return Promise.resolve(data);
diff --git a/superset/views/core.py b/superset/views/core.py
index a11b316..0eece78 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -2636,7 +2636,7 @@ class Superset(BaseSupersetView):
table.columns = cols
table.metrics = [SqlMetric(metric_name="count", expression="count(*)")]
db.session.commit()
- return self.json_response(json.dumps({"table_id": table.id}))
+ return json_success(json.dumps({"table_id": table.id}))
@has_access
@expose("/table/<database_id>/<table_name>/<schema>/")
diff --git a/tests/sqla_models_tests.py b/tests/sqla_models_tests.py
index f089628..bbf0d22 100644
--- a/tests/sqla_models_tests.py
+++ b/tests/sqla_models_tests.py
@@ -14,7 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-from superset import db
from superset.connectors.sqla.models import SqlaTable, TableColumn
from superset.db_engine_specs.druid import DruidEngineSpec
from superset.utils.core import get_main_database
@@ -44,7 +43,7 @@ class DatabaseModelTestCase(SupersetTestCase):
def test_cache_key_wrapper(self):
query = "SELECT '{{ cache_key_wrapper('user_1') }}' as user"
- table = SqlaTable(sql=query, database=get_main_database(db.session))
+ table = SqlaTable(sql=query, database=get_main_database())
query_obj = {
"granularity": None,
"from_dttm": None,