duckdb / duckdb/duckdb-python

ColumnExpression doesn't escape column name containing `.`

Đang mở
#46 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
187
Fork
112
Merge trung bình
13 giờ 29 phút
Pull request đã merge (30 ngày)
17

Mô tả

### 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Chạy bản tái hiện Python được cung cấp bằng duckdb.ColumnExpression và tên cột `b.a`, sau đó lần theo điểm vào đó trong gói Python duckdb. So sánh cách xử lý các tên chứa khoảng trắng với các tên chứa dấu chấm. Hoàn tất khi việc chọn cột có dấu chấm thành công mà không coi `b` là tên bảng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python, sql
Lĩnh vực
backend, databases
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
52/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.