aws / aws/amazon-redshift-python-driver

cursor.description cuts of column for sql functions

Đang mở
#243 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
220
Fork
86
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

## Driver version
redshift-connector==2.1.1

## Redshift version
Redshift 1.0.77292

## Client Operating System
Windows 11

## Python version
Python 3.9.5

## Table schema
select
GS_PE
SC_PE
SUM(SALDO_EUR)
from
Table

## Problem description

1. Expected behaviour:
When we use functions such as sum() the query result should display the exact column name like we have defined in the SQL-Query
2. Actual behaviour:
When we use functions such as sum() the query result is missing the column name within the functions brackets
3. Error message/stack trace:
No error message for this issue.
4. Any other details that can be helpful:

Result:

('gs_pe', 1043, None, None, None, None, None)
('sc_pe', 1043, None, None, None, None, None)
('sum', 1700, None, None, None, None, None)

Expected Result:

('gs_pe', 1043, None, None, None, None, None)
('sc_pe', 1043, None, None, None, None, None)
('sum(saldo_euro)', 1700, None, None, None, None, None)

## Python Driver trace logs
Sorry, I have no privileges to create tables on the Redshift DB.

## Reproduction code
with conn.cursor() as cur:
cur.execute(sql)
tuples_list = cur.fetchall()
dataframe = pd.DataFrame(tuples_list, columns=[desc[0] for desc in cur.description], dtype="object")
for field in cur.description:
print(field)

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

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

Hướng nghiên cứu

Chạy bản tái hiện được cung cấp trên thiết lập Redshift được báo cáo và kiểm tra cur.description sau truy vấn chứa SUM(SALDO_EUR). Theo dõi cách tên cột được tạo cho các hàm SQL, sau đó xác minh rằng phần mô tả báo cáo toàn bộ biểu thức, bao gồm cả sum(saldo_euro), mà không thay đổi các trường khác.

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

Đánh giá

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

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.