catches struct.error as DataError when params exceed 32767
Description
Execute method in the Connection class checks if there are too many parameters before an overflow error can occur when trying to pack int32 with an int16 pack function.
Motivation and Context
Passing in 32767 parameters is the upper limit for a prepared statement sent using extended query protocol. There is no short term fix to raise the parameter limit. Users right now need a better error message output. The new error message output: classifies error as DataError instead of struct.error, communicates that the bind parameter limit has been exceeded, and suggests work arounds to the user.
Conducted manual testing to raise the error parameters > 32767 as well as to not raise the error < 32767
Wrote unit and integration tests for the cursor.
The tests check that both cursor.insert_data_bulk (csv) and cursor.execute (parameterized query) throw the error.
pre-commit hooks successfully run and reformatted the code as expected.
Screenshots (if appropriate)
Types of changes
[x] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
Checklist
[x] Local run of ./build.sh succeeds
[x] Code changes have been run against the repository's pre-commit hooks
catches struct.error as DataError when params exceed 32767
Description
Execute method in the Connection class checks if there are too many parameters before an overflow error can occur when trying to pack int32 with an int16 pack function.
Motivation and Context
Passing in 32767 parameters is the upper limit for a prepared statement sent using extended query protocol. There is no short term fix to raise the parameter limit. Users right now need a better error message output. The new error message output: classifies error as DataError instead of struct.error, communicates that the bind parameter limit has been exceeded, and suggests work arounds to the user.
This change addresses this issue.
Testing
Conducted manual testing to raise the error parameters > 32767 as well as to not raise the error < 32767
Wrote unit and integration tests for the cursor. The tests check that both cursor.insert_data_bulk (csv) and cursor.execute (parameterized query) throw the error.
pre-commit hooks successfully run and reformatted the code as expected.
Screenshots (if appropriate)
Types of changes
Checklist
./build.sh
succeedspytest test/unit
and they are passing.