You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FEAT: Adding money and smallmoney support in executemany (#246)
### Work Item / Issue Reference
<!--
IMPORTANT: Please follow the PR template guidelines below.
For mssql-python maintainers: Insert your ADO Work Item ID below (e.g.
AB#37452)
For external contributors: Insert Github Issue number below (e.g. #149)
Only one reference is required - either GitHub issue OR ADO Work Item.
-->
<!-- mssql-python maintainers: ADO Work Item -->
>
[AB#34936](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/34936)
[AB#34937](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/34937)
<!-- External contributors: GitHub Issue -->
> GitHub Issue: #<ISSUE_NUMBER>
-------------------------------------------------------------------
### Summary
<!-- Insert your summary of changes below. Minimum 10 characters
required. -->
This pull request improves the handling of `decimal.Decimal` values and
`None` (NULL) values when using `executemany` to 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`:
* Updated the parameter processing logic in `cursor.py` to ensure that
`decimal.Decimal` values are properly converted for VARCHAR columns and
that `None` values 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:
* Added `test_money_smallmoney_roundtrip_executemany` to verify that
inserting and retrieving MONEY and SMALLMONEY values using `executemany`
with `decimal.Decimal` works as expected, including checks for value
equality and type.
* Added `test_money_smallmoney_executemany_null_handling` to ensure that
inserting NULLs into MONEY and SMALLMONEY columns via `executemany`
behaves correctly and returns the expected results.
<!--
### PR Title Guide
> For feature requests
FEAT: (short-description)
> For non-feature requests like test case updates, config updates ,
dependency updates etc
CHORE: (short-description)
> For Fix requests
FIX: (short-description)
> For doc update requests
DOC: (short-description)
> For Formatting, indentation, or styling update
STYLE: (short-description)
> For Refactor, without any feature changes
REFACTOR: (short-description)
> For release related changes, without any feature changes
RELEASE: #<RELEASE_VERSION> (short-description)
### Contribution Guidelines
External contributors:
- Create a GitHub issue first:
https://github.com/microsoft/mssql-python/issues/new
- Link the GitHub issue in the "GitHub Issue" section above
- Follow the PR title format and provide a meaningful summary
mssql-python maintainers:
- Create an ADO Work Item following internal processes
- Link the ADO Work Item in the "ADO Work Item" section above
- Follow the PR title format and provide a meaningful summary
-->
0 commit comments