aws / aws/amazon-redshift-python-driver

VARBYTE is decoded into utf-8

オープン
#261 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
220
フォーク
86
PR マージ指標
30日以内にマージされた PR はありません

説明

In readme VARBYTE is stated as supported as Python's `bytes` type. When trying to query data VARBYTE data from Redshift, 'utf-8' decoding error is thrown.

### Reproduction

```python
import redshift_connector

DROP_DDL = "drop table if exists varbyte_repro"
CREATE_DDL = """create table varbyte_repro(
my_var varbyte
);
"""
INSERT_DML = "insert into varbyte_repro(my_var) values (from_hex(SHA1('hello')))"
QUERY = "select * from varbyte_repro"

with redshift_connector.connect(
host="replaced",
database="replaced",
user="replaced",
password="replaced",
) as conn, conn.cursor() as cursor:
conn.autocommit = True
cursor.execute(DROP_DDL)
cursor.execute(CREATE_DDL)
cursor.execute(INSERT_DML)
cursor.execute(QUERY)
```

### Expected

Last `cursor.execute` runs without issue (so that later something like `cursor.fetchall` could be used)

### Actual

Error thrown:
```
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xaa in position 0: invalid start byte
```

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

提供された Python 再現コードを Redshift に対して実行し、最終クエリの実行時における connector の VARBYTE 結果デコード経路を調査してください。VARBYTE 値が UnicodeDecodeError なしで Python bytes として返されることを確認し、その後、実証されたクエリ動作のカバレッジを追加または更新してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
database
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。