FEAT: Adding money and smallmoney support in executemany#246
Merged
gargsaumya merged 6 commits intomainfrom Sep 24, 2025
Merged
FEAT: Adding money and smallmoney support in executemany#246gargsaumya merged 6 commits intomainfrom
gargsaumya merged 6 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for handling decimal.Decimal and None values in MONEY and SMALLMONEY columns when using executemany. The changes improve parameter processing to correctly convert decimal values and skip null values during type conversion.
- Enhanced
executemanyparameter processing to handle decimal values for VARCHAR columns (money/smallmoney) and properly skip None values - Added comprehensive test coverage for money/smallmoney roundtrip operations and null handling with
executemany
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| mssql_python/cursor.py | Updated parameter processing logic in executemany to handle decimal conversion for VARCHAR columns and skip None values |
| tests/test_004_cursor.py | Added two new test functions to verify money/smallmoney roundtrip behavior and null handling with executemany |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
sumitmsft
reviewed
Sep 19, 2025
sumitmsft
requested changes
Sep 19, 2025
Contributor
sumitmsft
left a comment
There was a problem hiding this comment.
Added a small comment..
sumitmsft
reviewed
Sep 23, 2025
sumitmsft
requested changes
Sep 23, 2025
Contributor
sumitmsft
left a comment
There was a problem hiding this comment.
Please add a few test cases. Rest all looks good to me.
bewithgaurav
approved these changes
Sep 24, 2025
sumitmsft
approved these changes
Sep 24, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Work Item / Issue Reference
Summary
This pull request improves the handling of
decimal.Decimalvalues andNone(NULL) values when usingexecutemanyto insert data into MONEY and SMALLMONEY columns in SQL Server. It also adds comprehensive tests to verify correct roundtrip and NULL handling for these types.Improvements to parameter processing in
executemany:cursor.pyto ensure thatdecimal.Decimalvalues are properly converted for VARCHAR columns and thatNonevalues are correctly skipped during conversion. This helps prevent type errors and ensures correct database insertion for MONEY, SMALLMONEY, and related types.Expanded test coverage for MONEY and SMALLMONEY types:
test_money_smallmoney_roundtrip_executemanyto verify that inserting and retrieving MONEY and SMALLMONEY values usingexecutemanywithdecimal.Decimalworks as expected, including checks for value equality and type.test_money_smallmoney_executemany_null_handlingto ensure that inserting NULLs into MONEY and SMALLMONEY columns viaexecutemanybehaves correctly and returns the expected results.