[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
This commit is contained in:
Arpit 2019-07-22 11:17:34 +05:30 committed by Ville Brofeldt
parent 4568b2a532
commit ee3430cce5
3 changed files with 3 additions and 5 deletions

View File

@ -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);

View File

@ -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>/")

View File

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