FEAT: Bulk Copy Options #106
Closed
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.
ADO Work Item Reference
Summary
This pull request introduces significant updates to the
mssql_pythonlibrary, focusing on enhancing theBCPOptionsandColumnFormatclasses, improving error handling, and adding comprehensive unit tests. The changes include refactoring the code for better maintainability, adding logging for debugging, and introducing new features and validations for bulk copy operations.Enhancements to
BCPOptionsandColumnFormat:BCPOptions(query,row_terminator,bulk_mode) andColumnFormat(user_data_type,terminator_len) to support additional BCP features. Updated default values for some fields. [1] [2] [3]columnsvs.format_file). Logging has been added for detailed error messages. [1] [2]Refactoring and Code Simplification:
row_terminatorfromColumnFormatandwrite_format_filefromBCPOptions) to streamline the codebase. [1] [2]directionandbulk_modeinto constants for better maintainability. [1] [2]New Constants for BCP Options:
BCPControlOptionsenum inconstants.pyto define string representations of BCP control options, improving clarity and consistency.Unit Tests for Bulk Copy Operations:
tests/test_007_bulkOptions.py) with unit tests forBCPOptionsandColumnFormat. Tests cover valid instantiations, invalid values, and edge cases such as conflicts betweencolumnsandformat_file.