googleapis / googleapis/google-cloud-python

Grouping by struct member broken in 1.11

Đang mở
#15,775 3 bình luận 0 reaction 2 người được giao Được @chalmerlowe nhận Xem trên GitHub
api: bigquery
Ngôn ngữ chính
Python
Star
5.4k
Fork
1.8k
Merge trung bình
3 ngày 4 giờ
Pull request đã merge (30 ngày)
122

Mô tả

The following worked in 1.10 but raises an exception in 1.11:
```
from sqlalchemy import create_engine, Table, Integer, MetaData, Column, select, func
from sqlalchemy_bigquery import STRUCT

engine = create_engine(f"bigquery:///tmp", echo=True)
metadata = MetaData()
table = Table(
"table",
metadata,
Column("id", Integer, primary_key=True),
Column("nested", STRUCT(x=Integer))
)

query = (
select(
table.c.nested.x.label("x"),
)
.group_by(
"x"
)
)
print(query.compile(engine))
```
->
```
UnsupportedCompilationError: Compiler can't render element of type (Background on this error at: https://sqlalche.me/e/14/l7de)
```

I traced the issue back to this line: https://github.com/googleapis/python-bigquery-sqlalchemy/pull/1053/files#diff-efe1987a73ae5b54aa817dc8c70541025df89d9d08601c8ab33fa84ad8c09de7R344

Removing this check or catching the exception resolves the issue. Perhaps a safer way to do this check would be to see if it's a function and then check its name? Not totally sure but I'm sure you will know @tswast 🙂

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

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

Đánh giá

Issue này chưa được đánh giá.

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.