aws / aws/amazon-redshift-python-driver

The field names should be presented.

未关闭
#240 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
220
派生
86
PR 合并指标
30 天内没有已合并 PR

描述

The generated sql code for insert do not point the field names.

Then the only way to make it work is to order the field names in the dataframe.

```
if not self.__is_valid_table(table):
raise InterfaceError("Invalid table name passed to write_dataframe: {}".format(table))
sanitized_table_name: str = self.__sanitize_str(table)
arrays: list = df.values.tolist()
placeholder: str = ", ".join(["%s"] * len(arrays[0]))
sql: str = "insert into {table} values ({placeholder})".format(
table=sanitized_table_name, placeholder=placeholder
)
```
https://github.com/aws/amazon-redshift-python-driver/blob/64cbd54ef6a5e71d98ce193630d09267cc154379/redshift_connector/cursor.py#L584C1-L591C10

贡献指南

打开贡献指南

调研方向

Start in redshift_connector/cursor.py at the linked lines and trace the write_dataframe SQL generation. Confirm how dataframe column names are available, then verify that generated INSERT statements include field names so results no longer depend on dataframe column order.

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

评估

技术栈
aws, python
领域
databases
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

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