Skip to content

Commit

Permalink
forgot the return
Browse files Browse the repository at this point in the history
  • Loading branch information
hughhhh authored May 17, 2022
1 parent 4c7549d commit 6af71ee
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
7 changes: 1 addition & 6 deletions superset/queries/dao.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import json
import logging
from datetime import datetime
from typing import Any, Dict
Expand Down Expand Up @@ -53,11 +52,7 @@ def update_saved_query_exec_info(query_id: int) -> None:

@staticmethod
def save_metadata(query: Query, payload: Dict[str, Any]) -> None:

# pull relevant data from payload and store in json_metadata
# pull relevant data from payload and store in extra_json
columns = payload.get("columns", {})

# save payload into query object
db.session.add(query)
query.set_extra_json_key("columns", columns)
return
2 changes: 1 addition & 1 deletion superset/sqllab/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
QueryIsForbiddenToAccessException,
SqlLabException,
)
from superset.sqllab.execution_context_convertor import ExecutionContextConvertor
from superset.sqllab.limiting_factor import LimitingFactor

if TYPE_CHECKING:
Expand All @@ -42,7 +43,6 @@
from superset.sqllab.sql_json_executer import SqlJsonExecutor
from superset.sqllab.sqllab_execution_context import SqlJsonExecutionContext

from superset.sqllab.execution_context_convertor import ExecutionContextConvertor

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion superset/sqllab/execution_context_convertor.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def set_payload(

def serialize_payload(self) -> str:
if self._exc_status == SqlJsonExecutionStatus.HAS_RESULTS:
json.dumps(
return json.dumps(
apply_display_max_row_configuration_if_require(
self.payload, self._max_row_in_display_configuration
),
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/dao/queries_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ def test_query_dao_save_metadata(app_context: None, session: Session) -> None:
from superset.queries.dao import QueryDAO

query = session.query(Query).one()
QueryDAO.save_metadata(query=query, query_payload=json.dumps({"columns": []}))
QueryDAO.save_metadata(query=query, payload={"columns": []})
assert query.extra.get("columns", None) == []

0 comments on commit 6af71ee

Please sign in to comment.