aws / aws/amazon-redshift-python-driver

cursor.description cuts of column for sql functions

オープン
#243 コメント 0 件 リアクション 0 件 担当者 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 を短くまとめたダイジェスト。