-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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: unexpected commit causes pytest failure #20780
Conversation
Codecov Report
@@ Coverage Diff @@
## master #20780 +/- ##
==========================================
- Coverage 66.28% 65.51% -0.78%
==========================================
Files 1756 1756
Lines 66756 66758 +2
Branches 7049 7049
==========================================
- Hits 44252 43738 -514
- Misses 20708 21224 +516
Partials 1796 1796
Flags with carried forward coverage won't be shown. Click here to find out more.
|
9632a1e
to
c3f6cc6
Compare
db.session.query(models.Database) | ||
.filter_by(database_name=database_name) | ||
.autoflush(False) | ||
.first() | ||
db.session.query(models.Database).filter_by(database_name=database_name).first() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although the Select can also be placed in a transaction, it relies on the subsequent commit(), which is not useful.
Pinging @betodealmeida for awareness |
Hello @zhaoyongjie thanks for the PR!
Can you provide more context about this? How is the |
c3f6cc6
to
b94ac7e
Compare
The test case superset/tests/integration_tests/sqla_models_tests.py Lines 454 to 456 in 81bd496
but this transaction was interrupted by superset/superset/utils/database.py Lines 34 to 64 in 81bd496
The strange thing is that this only happens under Postgres, and only after the SQLAlchemy update. You can observe that L44 has a call Sorry I didn't delve into SQLAlchmey upgrade and PG dialects to continue research, ----- just remove autoflash(False) and prevent execute commit() if no need. |
SUMMARY
The latest SQLAlchemy upgrade seems to be changing the autoflush rule, the full background at here. It causes
test_fetch_metadata_for_updated_virtual_table
failure.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Pure backend changes, so no screenshot.
TESTING INSTRUCTIONS
should pass following command in local and passes CI.
ADDITIONAL INFORMATION