graphql-python / graphql-python/graphene-sqlalchemy

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

オープン
#392 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
985
フォーク
223
PR マージ指標
30日以内にマージされた PR はありません

説明

```
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.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。