duckdb / duckdb/duckdb-python

ColumnExpression doesn't escape column name containing `.`

未关闭
#46 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
187
派生
112
平均合并
13 小时 29 分钟
30 天内合并 PR
17

描述

### What happens?

If a column name contains a `'.'` I can't select it with `duckdb.ColumnExpression`. Should `ColumnExpression` not do the escaping for us, so we can just pass the column name?

At least, that's what happens for column names that contains spaces

### To Reproduce

```python
import duckdb

rel = duckdb.sql("""select * from values (1, 2), (3, 4) df(a, "b.a")""")
rel.select(duckdb.ColumnExpression('b.a'))
```
```python-traceback
---------------------------------------------------------------------------
BinderException Traceback (most recent call last)
Cell In[3], line 1
----> 1 rel.select(duckdb.ColumnExpression('b.a'))

BinderException: Binder Error: Referenced table "b" not found!
Candidate tables: "unnamed_relation_0ba05ea8514d33bd"
```

### OS:

linux

### DuckDB Package Version:

1.3.2

### Python Version:

3.12

### Full Name:

Marco Gorelli

### Affiliation:

Quansight Labs

### What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a nightly build

### Did you include all relevant data sets for reproducing the issue?

No - Other reason (please specify in the issue body)

### Did you include all code required to reproduce the issue?

- [x] Yes, I have

### Did you include all relevant configuration to reproduce the issue?

- [x] Yes, I have

贡献指南

打开贡献指南

调研方向

使用 duckdb.ColumnExpression 和列名 `b.a` 运行提供的 Python 重现代码,然后在 duckdb Python 包中追踪该入口点。比较包含空格的名称与包含点的名称的处理方式。完成的标准是能够成功选择带点的列,而不会将 `b` 当作表名处理。

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

评估

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

把新 issue 发到你的邮箱

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