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

fix: add get_column function for Query obj #21691

Merged
merged 5 commits into from
Oct 5, 2022
Merged

fix: add get_column function for Query obj #21691

merged 5 commits into from
Oct 5, 2022

Conversation

hughhhh
Copy link
Member

@hughhhh hughhhh commented Oct 3, 2022

SUMMARY

With this PR, we are now using the get_column function within the BaseDatasource, but we didn't incorporate this inside Query model from the original spec. Adding it now to fix the issue for queries being able to execute inside explore

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov
Copy link

codecov bot commented Oct 3, 2022

Codecov Report

Merging #21691 (6dd1d28) into master (7b66e0b) will decrease coverage by 0.00%.
The diff coverage is 20.00%.

@@            Coverage Diff             @@
##           master   #21691      +/-   ##
==========================================
- Coverage   66.85%   66.84%   -0.01%     
==========================================
  Files        1799     1799              
  Lines       68875    68867       -8     
  Branches     7319     7314       -5     
==========================================
- Hits        46044    46035       -9     
- Misses      20944    20953       +9     
+ Partials     1887     1879       -8     
Flag Coverage Δ
hive 52.91% <20.00%> (-0.01%) ⬇️
mysql 78.24% <20.00%> (-0.02%) ⬇️
postgres 78.30% <20.00%> (-0.02%) ⬇️
presto 52.81% <20.00%> (-0.01%) ⬇️
python 81.44% <20.00%> (-0.02%) ⬇️
sqlite 76.80% <20.00%> (-0.02%) ⬇️
unit 50.95% <20.00%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
superset/common/query_context_processor.py 88.51% <ø> (ø)
superset/models/sql_lab.py 74.70% <20.00%> (-1.82%) ⬇️
...c/SqlLab/components/RunQueryActionButton/index.tsx 72.72% <0.00%> (-6.07%) ⬇️
...frontend/src/profile/components/CreatedContent.tsx 77.77% <0.00%> (-4.05%) ⬇️
...frontend/src/SqlLab/components/SqlEditor/index.jsx 53.84% <0.00%> (-1.83%) ⬇️
...nd/src/views/CRUD/data/dataset/AddDatasetModal.tsx 42.50% <0.00%> (-1.69%) ⬇️
superset-frontend/src/SqlLab/actions/sqlLab.js 61.94% <0.00%> (-1.05%) ⬇️
...plore/components/DataTablesPane/DataTablesPane.tsx 80.48% <0.00%> (-0.91%) ⬇️
superset-frontend/src/views/App.tsx 0.00% <0.00%> (ø)
superset-frontend/src/SqlLab/App.jsx 0.00% <0.00%> (ø)
... and 11 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -183,7 +182,7 @@ def sql_tables(self) -> List[Table]:
return list(ParsedQuery(self.sql).tables)

@property
def columns(self) -> List[ResultSetColumnType]:
def columns(self) -> List[Dict[str, Any]]:

Choose a reason for hiding this comment

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

Not for changing, just curious why moving from a typed dict to a general one?

Copy link
Member

@Antonio-RiveroMartnez Antonio-RiveroMartnez left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@pkdotson pkdotson left a comment

Choose a reason for hiding this comment

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

lgtm!

@hughhhh hughhhh added the need:qa-review Requires QA review label Oct 4, 2022
@hughhhh
Copy link
Member Author

hughhhh commented Oct 4, 2022

/testenv up

@github-actions
Copy link
Contributor

github-actions bot commented Oct 4, 2022

@hughhhh Ephemeral environment spinning up at http://35.92.220.6:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@jinghua-qa
Copy link
Member

I found an issue when i tested in the ephemeral env:
when i make a query in sql, the column is date but when i create chart and open in explore, the date column become string
repo steps:
1, query : Select * From "birth_names"
2, observe the column type of ds is "Datetime"
3, create chart and open the query in explore
4, observe the ds column type

Expected:
same column type in sql and explore

Actual:
datetime column become string in explore, user can not create time series related charts

Screen.Recording.2022-10-04.at.11.35.39.AM.mov

@hughhhh
Copy link
Member Author

hughhhh commented Oct 5, 2022

/testenv up

1 similar comment
@hughhhh
Copy link
Member Author

hughhhh commented Oct 5, 2022

/testenv up

@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2022

@hughhhh Ephemeral environment spinning up at http://54.212.89.97:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

1 similar comment
@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2022

@hughhhh Ephemeral environment spinning up at http://54.212.89.97:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@hughhhh hughhhh merged commit 51c54b3 into master Oct 5, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2022

Ephemeral environment shutdown and build artifacts deleted.

sadpandajoe pushed a commit to preset-io/superset that referenced this pull request Oct 6, 2022
@sadpandajoe
Copy link
Contributor

🏷️ preset:2022.39

@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 2024
@mistercrunch mistercrunch deleted the fix-cpq-get-col branch March 26, 2024 16:11
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 need:qa-review Requires QA review size/S 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants