support new Cursor attribute that provides information on completed commands

Đang mở
#388 1 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python, sql
Lĩnh vực
databases

Hướng nghiên cứu

Bắt đầu với DatabricksConnectionManager.get_response() trong dbt-databricks, nơi issue xác định thông báo "OK" được hardcode, và kiểm tra cursor của connector cũng như cách xử lý kết quả lệnh. So sánh đầu ra mong muốn với các tag CommandComplete của PostgreSQL và các thuộc tính driver được liệt kê. Được xem là hoàn thành khi các lệnh đã hoàn tất cung cấp một thuộc tính cursor phù hợp và get_response() báo cáo thao tác cùng số lượng hàng bị ảnh hưởng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement

similar to: https://github.com/aws/amazon-redshift-python-driver/issues/220

While a Cursor attribute providing SQL State Code is not officially a part of PEP 249: Python DB API 2.0 spec, it's a common enough convention and would greatly enhance the user experience of dbt-databricks users (👀 @benc-db)

Many database drivers provide this as a Cursor attribute, dbt was able to depend on these drivers to provide it for a ConnectionManager.get_response() method, which reports to users after successful queries the kind of operation performed (SELECT, INSERT, CREATE) and the numbers of rows affected.

However, this is not fully supported today in dbt-databrick, see DatabricksConnectionManager.get_response() where message is hardcoded as "OK" instead of returning more information.

Support for SQL state amongst popular analytics database drivers
Driver Cursor attribute (docs)
psycopg2 statusmessage
snowflake-connector-python sqlstate
Ideal implementation

Follow Postgres's CommandComplete message

Command Tag rows indicates the number of rows
INSERT INSERT 0 rows inserted
DELETE DELETE rows deleted
UPDATE UPDATE rows updated
MERGE MERGE rows inserted, updated, or deleted
SELECT / CREATE TABLE AS SELECT rows retrieved
MOVE MOVE rows ursor's position has been changed by
FETCH FETCH rows that have been retrieved from the cursor
COPY COPY rows copied, only in PostgreSQL 8.2 and later
Ngôn ngữ chính
Python
Star
233
Fork
152
Merge trung bình
21 giờ 5 phút
Pull request đã merge (30 ngày)
10

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của databricks/databricks-sql-python

Tất cả issue của databricks/databricks-sql-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.