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

Use correct db in a multi db setup #538

Merged
merged 1 commit into from
Jan 10, 2022
Merged

Use correct db in a multi db setup #538

merged 1 commit into from
Jan 10, 2022

Conversation

glujan
Copy link
Contributor

@glujan glujan commented Jan 6, 2022

SQLCompiler has a .connection instance which is already aware of what
database it should use. As such, when running EXPLAIN query let's use
that connection instead of connection to a default database.

Fixes #522.

I will add unit tests early next week.

@codecov
Copy link

codecov bot commented Jan 7, 2022

Codecov Report

Merging #538 (70d78cc) into master (2a9880e) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #538      +/-   ##
==========================================
- Coverage   84.60%   84.59%   -0.01%     
==========================================
  Files          51       51              
  Lines        2059     2058       -1     
==========================================
- Hits         1742     1741       -1     
  Misses        317      317              
Impacted Files Coverage Δ
silk/sql.py 78.12% <100.00%> (-0.34%) ⬇️

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 2a9880e...70d78cc. Read the comment docs.

@auvipy auvipy self-requested a review January 7, 2022 14:00
SQLCompiler has a .connection instance which is already aware of what
database it should use. As such, when running EXPLAIN query let's use
that connection instead of connection to a default database.

Fixes #522.
@glujan
Copy link
Contributor Author

glujan commented Jan 10, 2022

@auvipy I think tests should pass now and the PR is ready for review.

Copy link
Contributor

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

let's see what CI says

@glujan
Copy link
Contributor Author

glujan commented Jan 10, 2022

Look like coverage has slightly dropped because from django.db import connection line was removed from silk/sql.py

Copy link
Contributor

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

I want to see some more feedback

@auvipy auvipy added the Bugfix label Jan 10, 2022
@auvipy auvipy merged commit 8f8d159 into jazzband:master Jan 10, 2022
@glujan glujan deleted the Use-correct-db-in-multidb-setup branch January 10, 2022 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

upgrade 4.1.0 to 4.2.0 cause access to wrong table
3 participants