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

refactor: sql lab command: separate concerns into different modules #16917

Merged
merged 18 commits into from
Oct 3, 2021

Conversation

ofekisr
Copy link
Contributor

@ofekisr ofekisr commented Sep 30, 2021

SUMMARY
The sql_json view code in superset core view without any "clean code" standard and it does not adopt any software development principle.

This is the sixteenth PR in the sequence of future PRs (previous PR) try to solve it by refactoring the code.

The PR focus on separating sqlJsonCommand concerns into dependencies (interfaces)

actually, there are no logic changes so it implies on the current tests.

@amitmiran137 amitmiran137 changed the title refactor: sql lab command: separate concerns into small pieces refactor: sql lab command: separate concerns into different modules Sep 30, 2021
@ofekisr ofekisr force-pushed the refactor/sqllab3 branch 3 times, most recently from 8957fb0 to dcf24fb Compare October 2, 2021 17:10
@codecov
Copy link

codecov bot commented Oct 2, 2021

Codecov Report

Merging #16917 (98ca456) into master (77e7d16) will increase coverage by 0.00%.
The diff coverage is 82.70%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #16917    +/-   ##
========================================
  Coverage   77.03%   77.03%            
========================================
  Files        1021     1026     +5     
  Lines       54846    55005   +159     
  Branches     7481     7481            
========================================
+ Hits        42250    42375   +125     
- Misses      12349    12383    +34     
  Partials      247      247            
Flag Coverage Δ
hive 81.44% <82.70%> (-0.01%) ⬇️
mysql 81.83% <82.44%> (-0.02%) ⬇️
postgres 81.90% <82.70%> (-0.02%) ⬇️
presto 81.77% <82.70%> (-0.02%) ⬇️
python 82.39% <82.70%> (-0.03%) ⬇️
sqlite 81.51% <82.44%> (+0.02%) ⬆️

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

Impacted Files Coverage Δ
superset/charts/dao.py 88.63% <ø> (ø)
superset/sqllab/sqllab_execution_context.py 90.55% <ø> (ø)
superset/sqllab/sql_json_executer.py 74.39% <74.39%> (ø)
superset/sqllab/exceptions.py 67.39% <75.00%> (-13.57%) ⬇️
superset/sqllab/command.py 85.21% <77.08%> (+2.22%) ⬆️
superset/sqllab/execution_context_convertor.py 86.95% <86.95%> (ø)
superset/sqllab/query_render.py 88.46% <88.46%> (ø)
superset/dao/base.py 95.12% <88.88%> (-1.76%) ⬇️
superset/sqllab/validators.py 88.88% <88.88%> (ø)
superset/views/core.py 76.85% <96.42%> (+0.37%) ⬆️
... and 9 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 77e7d16...98ca456. Read the comment docs.

Copy link
Member

@amitmiran137 amitmiran137 left a comment

Choose a reason for hiding this comment

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

nice separation of concerns!

@amitmiran137 amitmiran137 merged commit 0d0c759 into apache:master Oct 3, 2021
@amitmiran137 amitmiran137 deleted the refactor/sqllab3 branch October 3, 2021 08:16
@etr2460 etr2460 mentioned this pull request Oct 7, 2021
9 tasks
@@ -14,6 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# pylint: disable=arguments-renamed
Copy link
Member

@john-bodley john-bodley Oct 7, 2021

Choose a reason for hiding this comment

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

@ofekisr could we move these to the lines where the issue occurs? There was an effort in #16589 to remove top-level Pylint disable checks as it's i) unclear to the reader where these violations are occurring, and ii) potentially masks issues in future changes.

I realize that this wasn't clear and so adding it to the CONTRIBUTING.md in #17016.

Copy link
Member

@amitmiran137 amitmiran137 Oct 8, 2021

Choose a reason for hiding this comment

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

Hi @john-bodley as you notice this is the only change that was done to the file.
It was done bc all of a sudden pylint required it in the CI

The recent series of pylint rules changes that was done has awaken wiered behaviour and the CI and require us to work for the pylint instead of it working for us

linting all of sudden became a disturbance we need hop over on every PR

stevenuray pushed a commit to preset-io/superset that referenced this pull request Oct 16, 2021
mistercrunch added a commit to preset-io/superset that referenced this pull request Oct 16, 2021
sadpandajoe added a commit to preset-io/superset that referenced this pull request Oct 18, 2021
opus-42 pushed a commit to opus-42/incubator-superset that referenced this pull request Nov 14, 2021
…pache#16917)

* chore move sql_execution_context to sqllab package

* add new helper methods into base Dao

* refactor separate get existing query concern from command

* refactor separate query access validation concern

* refactor separate get query's database concern from command

* refactor separate get query rendering concern from command

* refactor sqllab_execution_context

* refactor separate creating payload for view

* chore decouple command from superset app

* fix pylint issues

* fix failed tests

* fix pylint issues

* fix failed test

* fix failed black

* fix failed black

* fix failed test
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 28, 2021
…pache#16917)

* chore move sql_execution_context to sqllab package

* add new helper methods into base Dao

* refactor separate get existing query concern from command

* refactor separate query access validation concern

* refactor separate get query's database concern from command

* refactor separate get query rendering concern from command

* refactor sqllab_execution_context

* refactor separate creating payload for view

* chore decouple command from superset app

* fix pylint issues

* fix failed tests

* fix pylint issues

* fix failed test

* fix failed black

* fix failed black

* fix failed test
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.4.0 labels Mar 13, 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/XL 🚢 1.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants