mirror of
https://github.com/apache/superset.git
synced 2026-04-20 00:24:38 +00:00
feat: run BQ queries as single statement (#11904)
* feat: run BQ queries as single statement * Update deps * Fix lint * Update superset/sql_lab.py Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com> Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
This commit is contained in:
@@ -296,7 +296,7 @@ def _serialize_and_expand_data(
|
||||
return (data, selected_columns, all_columns, expanded_columns)
|
||||
|
||||
|
||||
def execute_sql_statements( # pylint: disable=too-many-arguments, too-many-locals, too-many-statements
|
||||
def execute_sql_statements( # pylint: disable=too-many-arguments, too-many-locals, too-many-statements, too-many-branches
|
||||
query_id: int,
|
||||
rendered_query: str,
|
||||
return_results: bool,
|
||||
@@ -322,9 +322,15 @@ def execute_sql_statements( # pylint: disable=too-many-arguments, too-many-loca
|
||||
raise SqlLabException("Results backend isn't configured.")
|
||||
|
||||
# Breaking down into multiple statements
|
||||
parsed_query = ParsedQuery(rendered_query)
|
||||
statements = parsed_query.get_statements()
|
||||
logger.info("Query %s: Executing %i statement(s)", str(query_id), len(statements))
|
||||
if not db_engine_spec.run_multiple_statements_as_one:
|
||||
parsed_query = ParsedQuery(rendered_query)
|
||||
statements = parsed_query.get_statements()
|
||||
logger.info(
|
||||
"Query %s: Executing %i statement(s)", str(query_id), len(statements)
|
||||
)
|
||||
else:
|
||||
statements = [rendered_query]
|
||||
logger.info("Query %s: Executing query as a single statement", str(query_id))
|
||||
|
||||
logger.info("Query %s: Set query to 'running'", str(query_id))
|
||||
query.status = QueryStatus.RUNNING
|
||||
|
||||
Reference in New Issue
Block a user