Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

FEAT: Bulk Copy Options#106

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
jahnvi480 wants to merge6 commits intomain
base:main
Choose a base branch
Loading
fromjahnvi/bulk_copy_options
Open

Conversation

jahnvi480
Copy link
Contributor

@jahnvi480jahnvi480 commentedJun 25, 2025
edited by azure-boardsbot
Loading

ADO Work Item Reference

AB#34946


Summary

This pull request introduces significant updates to themssql_python library, focusing on enhancing theBCPOptions andColumnFormat classes, 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 toBCPOptions andColumnFormat:

  • Added new fields toBCPOptions (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]
  • Introduced stricter validation for fields in both classes, including checks for non-negative integers, valid enumerations, and mutually exclusive options (e.g.,columns vs.format_file). Logging has been added for detailed error messages.[1][2]

Refactoring and Code Simplification:

  • Removed unused imports and fields (e.g.,row_terminator fromColumnFormat andwrite_format_file fromBCPOptions) to streamline the codebase.[1][2]
  • Centralized allowed values fordirection andbulk_mode into constants for better maintainability.[1][2]

New Constants for BCP Options:

  • Introduced a newBCPControlOptions enum inconstants.py to define string representations of BCP control options, improving clarity and consistency.

Unit Tests for Bulk Copy Operations:

  • Added a new test suite (tests/test_007_bulkOptions.py) with unit tests forBCPOptions andColumnFormat. Tests cover valid instantiations, invalid values, and edge cases such as conflicts betweencolumns andformat_file.
  • Introduced fixtures for setting up temporary database tables and files, enabling integration tests for BCP operations.

@CopilotCopilotAI review requested due to automatic review settingsJune 25, 2025 12:49
Copy link
Contributor

@CopilotCopilotAI left a 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 PR enhances bulk copy capabilities in themssql_python library by extending option classes, tightening validations, adding logging, and introducing comprehensive unit tests.

  • ExtendedBCPOptions andColumnFormat with new fields (query,terminator_len,user_data_type,row_terminator) and default values.
  • Added stricter validation with detailed log messages and extracted constants for allowed directions and modes.
  • Introduced a newBCPControlOptions enum and a full test suite covering valid/invalid cases for bulk copy operations.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

FileDescription
tests/test_007_bulkOptions.pyNew tests forBCPOptions andColumnFormat, covering invalid and edge cases.
mssql_python/constants.pyAddedBCPControlOptions enum for BCP control string constants.
mssql_python/bcp_options.pyRefactored classes with new fields, logging, validation logic, and constants.
Comments suppressed due to low confidence (3)

mssql_python/bcp_options.py:14

  • [nitpick] The constant name ALLOWED_FILE_MODES may be misleading since it controls bulk_mode. Consider renaming it to ALLOWED_BULK_MODES for clarity.
ALLOWED_FILE_MODES = ("native", "char", "unicode")

mssql_python/bcp_options.py:1

  • The module and class docstrings should be updated to document the new fields (terminator_len,user_data_type,query,row_terminator) and their purpose for better API clarity.
"""

tests/test_007_bulkOptions.py:297

  • Add tests for the 'queryout' direction to verify that supplying aquery is enforced and that other options behave correctly. Also consider tests forrow_terminator behavior.
            )

@github-actionsgithub-actionsbot added the pr-size: largeSubstantial code update labelJul 1, 2025
@github-actionsgithub-actionsbot added pr-size: largeSubstantial code update and removed pr-size: largeSubstantial code update labelsJul 4, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

Copilot code reviewCopilotCopilot left review comments

At least 2 approving reviews are required to merge this pull request.

Assignees
No one assigned
Labels
pr-size: largeSubstantial code update
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@jahnvi480

[8]ページ先頭

©2009-2025 Movatter.jp