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

chore(sqla): assert query does not exceed 1 statement #11236

Merged
merged 1 commit into from
Oct 12, 2020

Conversation

villebro
Copy link
Member

@villebro villebro commented Oct 12, 2020

SUMMARY

Raise understandable error if query consists of multiple statements.

AFTER

For DML queries:
image
For multiple statements:
image

BEFORE

For DML queries:
image
For multiple statements:
image

TEST PLAN

CI + new test

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 Oct 12, 2020

Codecov Report

Merging #11236 into master will decrease coverage by 4.17%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11236      +/-   ##
==========================================
- Coverage   65.51%   61.34%   -4.18%     
==========================================
  Files         831      831              
  Lines       39303    39302       -1     
  Branches     3592     3592              
==========================================
- Hits        25751    24108    -1643     
- Misses      13443    15013    +1570     
- Partials      109      181      +72     
Flag Coverage Δ
#cypress ?
#javascript 62.40% <ø> (ø)
#python 60.70% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
superset/connectors/sqla/models.py 89.86% <100.00%> (+0.02%) ⬆️
superset-frontend/src/SqlLab/App.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/explore/App.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/dashboard/App.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/explore/index.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/dashboard/index.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/setup/setupColors.js 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/chart/ChartContainer.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/setup/setupFormatters.js 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/explore/reducers/index.js 0.00% <0.00%> (-100.00%) ⬇️
... and 166 more

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 e647286...6c86101. Read the comment docs.

@villebro villebro force-pushed the villebro/assert-multiple-q branch from 358721d to 6c86101 Compare October 12, 2020 11:30
@pull-request-size pull-request-size bot added size/M and removed size/S labels Oct 12, 2020
@villebro villebro force-pushed the villebro/assert-multiple-q branch from 6c86101 to 9482766 Compare October 12, 2020 11:31
@villebro villebro merged commit 9f3d089 into apache:master Oct 12, 2020
dpgaspar pushed a commit to preset-io/superset that referenced this pull request Oct 12, 2020
@villebro villebro deleted the villebro/assert-multiple-q branch October 12, 2020 19:15
@michellethomas
Copy link
Contributor

@villebro It looks like the error Virtual dataset query must be read-only is sometimes throwing when a query is actually readonly. Someone reported a query that included a WITH statement as having this error. The query is just a select query so I'm guessing that the WITH is getting misinterpreted as not read-only (but I haven't looked into it too much).

The query structure is something like

WITH data AS (
select column_1 from db.table_name
),
SELECT sum(column_1) AS total
FROM data

auxten pushed a commit to auxten/incubator-superset that referenced this pull request Nov 20, 2020
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
@mistercrunch mistercrunch added 🍒 0.38.0 🍒 0.38.1 🏷️ 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/M 🍒 0.38.0 🍒 0.38.1 🚢 1.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants