aws / aws/amazon-redshift-python-driver

cursor.description cuts of column for sql functions

未關閉
#243 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
220
分支
86
PR 合併指標
30 天內沒有已合併 PR

描述

## 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)

貢獻指南

開啟貢獻指南

研究方向

針對回報的 Redshift 設定執行提供的重現,並在包含 SUM(SALDO_EUR) 的查詢之後檢查 cur.description。追蹤 SQL 函式的欄名如何產生,然後確認 description 回報完整的運算式,包括 sum(saldo_euro),且不變更其他欄位。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
aws, python, sql
領域
databases
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。