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: add pylint rule for SQL importing (SIP-117) #26803

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

betodealmeida
Copy link
Member

SUMMARY

Pylint rule to prevent Superset from importing SQL parsing libraries outside of superset/sql_parse.py. Should be merged once #26786 has been completed.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

$ pylint --reports=no --score=no --disable=all --enable=C9999 superset/db_engine_specs/base.py
************* Module superset.db_engine_specs.base
superset/db_engine_specs/base.py:38:0: C9999: Disallowed SQL parsing import used (disallowed-import)
$ pylint --reports=no --score=no --disable=all --enable=C9999 superset/sql_parse.py
$

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

Copy link

codecov bot commented Jan 25, 2024

Codecov Report

Attention: Patch coverage is 0% with 20 lines in your changes missing coverage. Please review.

Project coverage is 69.47%. Comparing base (424b4c2) to head (a3a2dbc).
Report is 1314 commits behind head on master.

Files with missing lines Patch % Lines
superset/extensions/pylint.py 0.00% 20 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #26803      +/-   ##
==========================================
+ Coverage   67.16%   69.47%   +2.30%     
==========================================
  Files        1894     1895       +1     
  Lines       74176    74196      +20     
  Branches     8243     8243              
==========================================
+ Hits        49820    51546    +1726     
+ Misses      22287    20581    -1706     
  Partials     2069     2069              
Flag Coverage Δ
hive 53.75% <0.00%> (?)
mysql 77.89% <0.00%> (-0.07%) ⬇️
postgres 78.01% <0.00%> (-0.05%) ⬇️
presto 53.70% <0.00%> (?)
python 82.97% <0.00%> (+4.77%) ⬆️
sqlite 77.59% <0.00%> (-0.05%) ⬇️
unit 56.36% <0.00%> (?)

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@john-bodley
Copy link
Member

Thanks for adding this @betodealmeida. As part of SIP-99 I was hoping to do something similar to prevent the use of db.session.commit() or db.session.rollback() commands given these will be handled via SQLAlchemy's context manager.

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.

Woot! The new check found examples of invalid imports. Once these have been resolved this LGTM.

Copy link
Member

@michael-s-molina michael-s-molina left a comment

Choose a reason for hiding this comment

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

Love it! ❤️

@betodealmeida
Copy link
Member Author

I love that I can't merge this PR because of the rule it adds. 😆

I hope to be able to merge this soon...

@rusackas
Copy link
Member

rusackas commented Sep 4, 2024

Is this mergeable now? Closing/reopening to kick-start CI, though it probably needs a rebase.

@rusackas rusackas closed this Sep 4, 2024
@rusackas rusackas reopened this Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants