Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sqllab] fix: return pandas records in execute_sql_statements #9102

Merged
merged 2 commits into from
Feb 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions superset/sql_lab.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,9 @@ def execute_sql_statements(
)
query.end_time = now_as_float()

use_arrow_data = store_results and results_backend_use_msgpack
data, selected_columns, all_columns, expanded_columns = _serialize_and_expand_data(
result_set,
db_engine_spec,
store_results and results_backend_use_msgpack,
expand_data,
result_set, db_engine_spec, use_arrow_data, expand_data
)

# TODO: data should be saved separately from metadata (likely in Parquet)
Expand Down Expand Up @@ -430,6 +428,24 @@ def execute_sql_statements(
session.commit()

if return_results:
# since we're returning results we need to create non-arrow data
if use_arrow_data:
(
data,
selected_columns,
all_columns,
expanded_columns,
) = _serialize_and_expand_data(
result_set, db_engine_spec, False, expand_data
)
payload.update(
{
"data": data,
"columns": all_columns,
"selected_columns": selected_columns,
"expanded_columns": expanded_columns,
}
)
return payload

return None