graphql-python / graphql-python/graphene-sqlalchemy

Relationship isn't working if a model has a property named other than 'id'.

Đang mở
#392 5 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
985
Fork
223
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

```
class BusinessPriority(client.Model):
metric_views: List['MetricView'] = orm.relationship('MetricView', secondary='business_priority_metrics_link')

class MetricView(client.Model):
"""Data around metric view for Ops Insight"""
__tablename__ = 'metric_view'

row_id: Union[Column, int] = Column(name='id', type_=BigInteger, primary_key=True, autoincrement=True)
```
I get
```
"errors": [
{
"message": "type object 'MetricView' has no attribute 'id'",
"locations": [
{
"line": 8,
"column": 9
}
],
"path": [
"allBusinessPriorities",
"edges",
0,
"node",
"metricViews"
]
},
```

But if I change
```
row_id: Union[Column, int] = Column(name='id', type_=BigInteger, primary_key=True, autoincrement=True)
to
id: Union[Column, int] = Column(name='id', type_=BigInteger, primary_key=True, autoincrement=True)
```

The join and query works well.

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.