-
Notifications
You must be signed in to change notification settings - Fork 7
FEAT: BCP Python APIs #60
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 enhancements to the bulk copy functionality in the mssql_python package by adding a new BCPClient, improving validation in BCPOptions, and centralizing BCP control option constants.
- Introduces a new BCPClient class with detailed logging and BCP operation handling.
- Enhances validation logic in BCPOptions with additional checks and supports new parameters (bulk_mode, hints, code_page).
- Adds BCPControlOptions as an enum to centralize and standardize BCP control settings.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
mssql_python/constants.py | Added BCPControlOptions enum for BCP control settings. |
mssql_python/bcp_options.py | Updated types, default values, and validation logic for BCP options. |
mssql_python/bcp_main.py | Introduced BCPClient class to encapsulate bulk copy operations. |
Comments suppressed due to low confidence (1)
mssql_python/bcp_options.py:104
- [nitpick] There is a duplicated check for data_file being non-empty for 'in' or 'out' directions. Consider consolidating these validations to eliminate redundancy.
if self.direction in ["in", "out"]: ... if not self.data_file:
This is a duplicate of https://github.com/microsoft/mssql-python/pull/57/files which was reviewed earlier. Jahnvi has already resolved the comments and made necessary changes. We are approving this PR. |
… jahnvi/bcp_apis
… jahnvi/bcp_apis
0a6c1cd
This pull request introduces significant enhancements to the bulk copy functionality in the
mssql_python
package, including the addition of a newBCPClient
class, improved validation logic inBCPOptions
, and the introduction ofBCPControlOptions
for managing BCP control settings. These changes aim to provide better error handling, flexibility, and usability for bulk copy operations.New Features and Enhancements:
Bulk Copy Client:
BCPClient
class inmssql_python/bcp_main.py
to encapsulate bulk copy operations. It includes robust logging, validation, and integration withBCPWrapper
for executing BCP operations.Validation Improvements:
BCPOptions
to ensure correctness of parameters, including stricter checks fordirection
,data_file
,error_file
, and other attributes. Added support for new options such asbulk_mode
,hints
, andcode_page
.Constants for BCP Control:
BCPControlOptions
inmssql_python/constants.py
, providing a centralized enum for BCP control settings like batch size, max errors, and row terminators. This improves clarity and reduces hardcoding of control options.Code Refinements:
Default Values:
ColumnFormat
attributes (prefix_len
anddata_len
) to have default values of0
, and added a new optionalcol_name
attribute for column definitions.Type Adjustments:
Literal
types withstr
andUnion
inBCPOptions
to improve flexibility and compatibility with dynamically validated values.