-
Notifications
You must be signed in to change notification settings - Fork 27
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
autocommitparameter fromTruetoFalsein 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 |
sumitmsft
left a comment
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
autocommitsetting in the MSSQL Python library, changing it fromTruetoFalse. It also includes minor adjustments to tests and imports to reflect this change.Default
autocommitbehavior changes:mssql_python/connection.py: Updated thesetautocommitmethod to default toFalseinstead ofTrue.mssql_python/db_connection.py: Modified theconnectfunction to setautocommittoFalseby default.Test updates:
tests/test_003_connection.py: Updated thetest_autocommit_defaulttest to assert that the defaultautocommitvalue is nowFalse.Import cleanup:
tests/test_003_connection.py: Commented out unused imports frompyodbc.