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: remove get_columns_description duplication #24819

Merged
merged 1 commit into from
Jul 27, 2023
Merged

Conversation

betodealmeida
Copy link
Member

SUMMARY

Small refactoring removing duplicate logic.

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 Jul 26, 2023

Codecov Report

Merging #24819 (4919d60) into master (165afee) will increase coverage by 0.12%.
Report is 5 commits behind head on master.
The diff coverage is 78.26%.

❗ Current head 4919d60 differs from pull request most recent head 5207978. Consider uploading reports for the commit 5207978 to get more accurate results

@@            Coverage Diff             @@
##           master   #24819      +/-   ##
==========================================
+ Coverage   68.84%   68.96%   +0.12%     
==========================================
  Files        1902     1903       +1     
  Lines       73997    73996       -1     
  Branches     8195     8193       -2     
==========================================
+ Hits        50944    51034      +90     
+ Misses      20934    20846      -88     
+ Partials     2119     2116       -3     
Flag Coverage Δ
hive 54.15% <100.00%> (?)
mysql 79.19% <100.00%> (-0.01%) ⬇️
postgres 79.29% <100.00%> (-0.01%) ⬇️
presto 54.05% <100.00%> (-0.01%) ⬇️
python 83.35% <100.00%> (+0.23%) ⬆️
sqlite 77.86% <100.00%> (?)
unit 54.97% <0.00%> (+0.01%) ⬆️

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

Files Changed Coverage Δ
superset-frontend/src/SqlLab/App.jsx 0.00% <ø> (ø)
...tersConfigModal/Footer/CancelConfirmationAlert.tsx 100.00% <ø> (ø)
superset-frontend/src/hooks/apiResources/tables.ts 73.80% <ø> (ø)
...eFilters/FiltersConfigModal/FiltersConfigModal.tsx 71.09% <50.00%> (+0.13%) ⬆️
...t-frontend/src/components/AsyncAceEditor/index.tsx 91.66% <63.63%> (+0.55%) ⬆️
.../SqlLab/components/AceEditorWrapper/useKeywords.ts 80.00% <80.00%> (ø)
...d/src/SqlLab/components/AceEditorWrapper/index.tsx 68.42% <100.00%> (+2.15%) ⬆️
...uperset-frontend/src/hooks/apiResources/schemas.ts 65.62% <100.00%> (ø)
superset/connectors/sqla/models.py 91.37% <100.00%> (+0.14%) ⬆️
superset/connectors/sqla/utils.py 91.46% <100.00%> (+3.41%) ⬆️

... and 8 files with indirect coverage changes

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

Comment on lines -130 to -140
try:
with dataset.database.get_raw_connection(schema=dataset.schema) as conn:
cursor = conn.cursor()
query = dataset.database.apply_limit_to_sql(statements[0], limit=1)
db_engine_spec.execute(cursor, query)
result = db_engine_spec.fetch_data(cursor, limit=1)
result_set = SupersetResultSet(result, cursor.description, db_engine_spec)
cols = result_set.columns
except Exception as ex:
raise SupersetGenericDBErrorException(message=str(ex)) from ex
return cols
Copy link
Member Author

Choose a reason for hiding this comment

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

This is almost identical to get_columns_description, the only difference is the schema passed to the connection.

Copy link
Member

@john-bodley john-bodley left a comment

Choose a reason for hiding this comment

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

Thanks for the cleanup.

@betodealmeida betodealmeida merged commit 7cd317f into master Jul 27, 2023
55 checks passed
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.1.0 labels Mar 8, 2024
@mistercrunch mistercrunch deleted the sc-72620 branch March 26, 2024 18:04
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 🚢 3.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants