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

feat: run BQ queries as single statement #11904

Merged
merged 4 commits into from
Dec 3, 2020

Conversation

betodealmeida
Copy link
Member

SUMMARY

When running multiple statements, BigQuery will not keep track of state during the lifetime of the cursor. This means that queries like this one will fail:

DECLARE d DATE DEFAULT CURRENT_DATE();
CREATE TEMP FUNCTION Add(x INT64, y INT64) AS (x + y);
SELECT Add(3, 4);

See discussion here: googleapis/python-bigquery#377

This PR solves this problem by running queries as a single statement

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

2020-12-02-162506_564x568_scrot

TEST PLAN

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

@codecov-io
Copy link

codecov-io commented Dec 3, 2020

Codecov Report

Merging #11904 (7144adc) into master (721f911) will decrease coverage by 0.00%.
The diff coverage is 77.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11904      +/-   ##
==========================================
- Coverage   63.78%   63.78%   -0.01%     
==========================================
  Files         927      927              
  Lines       45006    45011       +5     
  Branches     4308     4308              
==========================================
+ Hits        28708    28711       +3     
- Misses      16120    16122       +2     
  Partials      178      178              
Flag Coverage Δ
javascript 63.17% <ø> (ø)
python 64.14% <77.77%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/sql_lab.py 79.62% <71.42%> (-0.67%) ⬇️
superset/db_engine_specs/base.py 87.50% <100.00%> (+0.03%) ⬆️
superset/db_engine_specs/bigquery.py 95.74% <100.00%> (+0.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 721f911...7144adc. Read the comment docs.

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, super happy to see this collaborative effort materialize like this! Minor non-blocking nit, LGTM.

superset/sql_lab.py Outdated Show resolved Hide resolved
Co-authored-by: Ville Brofeldt <[email protected]>
@betodealmeida betodealmeida merged commit 54bf707 into apache:master Dec 3, 2020
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.0.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/S 🚢 1.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants