aws / aws/amazon-redshift-python-driver

VARBYTE is decoded into utf-8

未关闭
#261 0 条评论 0 个 reaction 已指派 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
```

贡献指南

打开贡献指南

调研方向

Run the supplied Python reproduction against Redshift and inspect the connector's VARBYTE result-decoding path when the final query executes. Confirm that VARBYTE values are returned as Python bytes without a UnicodeDecodeError, then add or update coverage for the demonstrated query behavior.

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
database
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。