Skip to content

Conversation

@jahnvi480
Copy link
Contributor

PYTHON BCP OPTIONS

For feature requests

FEAT: This pull request introduces a new data model for managing BCP (Bulk Copy Program) options in the mssql_python package. The changes add two @dataclass structures, ColumnFormat and BCPOptions, to encapsulate the configuration details for BCP operations in a structured and type-safe manner.


Summary

  • mssql_python/bcp_options.py:
    • Added the ColumnFormat dataclass to define column-specific configurations such as prefix_len, data_len, and terminators (field_terminator and row_terminator).
    • Added the BCPOptions dataclass to represent BCP operation settings, including options for direction (in or out), file paths (data_file, error_file, etc.), batch size, error handling, and column configurations.

Copilot AI review requested due to automatic review settings May 20, 2025 08:10
Copy link
Contributor

Copilot AI 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 introduces structured data models for BCP (Bulk Copy Program) configuration to improve type safety and organization of bcp.exe options.

  • Added a ColumnFormat dataclass for column-specific format settings.
  • Added a BCPOptions dataclass encapsulating overall BCP operation parameters.
  • Centralized BCP flags and file paths into well-typed attributes for clarity.
Comments suppressed due to low confidence (1)

mssql_python/bcp_options.py:10

  • [nitpick] The name server_col is ambiguous; consider renaming to server_column_index for clarity and consistency.
server_col: int = 1 # Option: (format_file) or (server_col)

sumitmsft
sumitmsft previously approved these changes May 20, 2025
Copy link
Contributor

@sumitmsft sumitmsft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although this PR has just added the options for the BCP, I have added a few comments\best practices to be followed when you implement the logic. Make sure you adhere to all the validations I have suggested along with others wherever possible.

bewithgaurav
bewithgaurav previously approved these changes May 21, 2025
Copy link
Contributor

@sumitmsft sumitmsft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All requested changes have been merged. PR approved.

Copy link
Collaborator

@bewithgaurav bewithgaurav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-approved since the pending comments and changes are resolved now.

@sumitmsft sumitmsft merged commit 316f018 into main May 28, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants