-
Notifications
You must be signed in to change notification settings - Fork 16
FIX: Setting autocommit as False by default & add rollback on connection close #158
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
Conversation
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.
Pull Request Overview
This pull request changes the default autocommit behavior in the MSSQL Python library from True
to False
to align with standard database connection practices where transactions are explicit by default.
- Updated default
autocommit
parameter fromTrue
toFalse
in connection methods - Modified test assertions to reflect the new default behavior
- Cleaned up unused import comments in test files
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
mssql_python/db_connection.py | Changed default autocommit parameter to False in the connect function |
mssql_python/connection.py | Updated setautocommit method default parameter to False |
tests/test_003_connection.py | Updated test assertion and commented out unused imports |
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.
Left some comments. Please resolve these.
Work Item / Issue Reference
Summary
This pull request updates the default behavior of the
autocommit
setting in the MSSQL Python library, changing it fromTrue
toFalse
. It also includes minor adjustments to tests and imports to reflect this change.Default
autocommit
behavior changes:mssql_python/connection.py
: Updated thesetautocommit
method to default toFalse
instead ofTrue
.mssql_python/db_connection.py
: Modified theconnect
function to setautocommit
toFalse
by default.Test updates:
tests/test_003_connection.py
: Updated thetest_autocommit_default
test to assert that the defaultautocommit
value is nowFalse
.Import cleanup:
tests/test_003_connection.py
: Commented out unused imports frompyodbc
.