bulkcopy accepts four-part table names that SQL Server always rejects
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 70/100
Hướng nghiên cứu
Giới hạn số phần là hằng số MAX_PARTS trong bộ phân tích định danh sao chép hàng loạt, hiện đang cho phép bốn phần; thay đổi bắt đầu từ đây. Hãy hạ giới hạn xuống còn ba để một đích có bốn phần thất bại với cùng lỗi sử dụng mà payload hiển thị cho năm phần, trước mọi lệnh gọi tới máy chủ. Hoàn thành khi trường hợp bốn phần của repro ném lỗi sử dụng mà không tới được bước tra cứu metadata, và các trường hợp ba phần và năm phần vẫn hoạt động như mô tả.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
The 1.16.0 bulk copy identifier parser allows up to four name parts (MAX_PARTS is 4), so cursor.bulkcopy() accepts server.database.schema.table. SQL Server doesn't allow a server prefix on a bulk insert target, so every four-part name fails with error 117 after metadata lookup starts. A five-part name fails earlier, in the driver, with a clear usage error.
Exception message:
RuntimeError: Sql Error: 117: Class 15: State 1: The object name 'dlevy-sql25.test1.dbo.fp116' contains more than the maximum number of prefixes. The maximum is 2. on dlevy-sql25 in at line 1
For comparison, a five-part name:
RuntimeError: Failed to retrieve destination metadata: Usage Error: Too many identifier parts: 5 (maximum is 4)
To reproduce
import os
import mssql_python
conn = mssql_python.connect(os.environ["SQL_CONNECTION_STRING"], timeout=30)
cur = conn.cursor()
cur.execute("CREATE TABLE dbo.fp116 (i int)")
conn.commit()
server = cur.execute("SELECT @@SERVERNAME").fetchval()
try:
cur.bulkcopy(f"[{server}].test1.dbo.fp116", [(1,)])
except Exception as e:
print(type(e).__name__, e)
try:
cur.bulkcopy("a.b.c.d.e", [(1,)])
except Exception as e:
print(type(e).__name__, e)
cur.execute("DROP TABLE dbo.fp116")
conn.commit()
Expected behavior
The parser should allow at most three parts for a bulk copy target and reject a four-part name with the same kind of usage error it gives for five parts, before it contacts the server. The current limit of four suggests linked-server targets work, but they can't.
Further technical details
Python version: 3.14.0
mssql-python: 1.16.0 (pip), default msodbcsql18 provider
SQL Server version: SQL Server 2025 (RTM-CU9) 17.0.5005.3, Enterprise Edition, EngineEdition 3
Operating system: Windows 11
Additional context
Found while documenting the 1.16.0 bulk copy identifier changes in MicrosoftDocs/sql-docs-pr#38337. The docs now list one-part through three-part names and say that SQL Server rejects the four-part form.
- Ngôn ngữ chính
- Python
- Star
- 478
- Fork
- 62
- Merge trung bình
- 3 ngày 19 phút
- Pull request đã merge (30 ngày)
- 28
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/mssql-python
-
triage needed
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
microsoft/mssql-python#846 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
macOS: encrypted connections fail after Homebrew moved the `openssl` alias to `openssl@4`Có thể đã có người làm @bewithgaurav đã nhận 15 ngày trước. Đang mởarea: packaging-platform bug triage needed
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
microsoft/mssql-python#826 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Announcement: mssql-python is coming to Django through mssql-django 2.0Có thể làm lại được @bewithgaurav đã nhận 42 ngày trước và không có pull request nào đang mở. Đang mởannouncement
microsoft/mssql-python#748 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Connection pool can briefly exceed max_size when pooling is disabled under loadCó thể đã có người làm @bewithgaurav đã nhận 25 ngày trước. Đang mởarea: connectivity-auth bug triage done under development
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 62/100
microsoft/mssql-python#746 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Decimal in money range still string-binds on the executemany pathCó thể đã có người làm @bewithgaurav đã nhận 25 ngày trước. Đang mởarea: data-types bug triage done under development
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
microsoft/mssql-python#745 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của microsoft/mssql-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
huggingface/sentence-transformers#4186 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
documentation good first issue
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 72/100
sujithputta02/Esapay#13 ·
-
bot-triaged module: correctness (silent) module: mps module: NaNs and Infs triage review
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
README: CI link/badge checkĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
SCIInstitute/SCIRun#2842 ·
Maintainer thường phản hồi trong vòng 3 ngày