many-many
ユーザーとオークションの間に というテーブルがありますplacedBids
。
私はオークションからクエリを行っているので、オークションからアクセスできるように backref も呼び出します。たとえば、入札さplacedBids
れた入札の(これは、 と呼ばれる別の backref がすでにあるため、変更しましたが、問題がある可能性があります)それを試みるために、私は多くのことを試しました。placedbids
userid
username
user
placedbids
userbids
users
sqlalchemy
userbids
これは私の最後のクエリです:
auction = dbsession.query(Auction.id, Auction.endTime, Auction.currentPrice, Product.description, Product.title, User.username, PlacedBids.timeplaced, PlacedBids.userbids.username).outerjoin(Auction.placedbids).join(Auction.products).outerjoin(Auction.leader).filter( Auction.id == request.matchdict['id']).all()
エラー:
2012-05-18T16:40:36+00:00 app[web.1]: AttributeError: 'InstrumentedAttri bute' オブジェクトにも 'Comparator' オブジェクトにも属性 'username' がありません
outerjoin(Auction.placedbids.userbids)
などなどにも参加してみPlacedBids.userbids
ましたが…
問題なく取得できる を取得するsqlalchemy
ために追加のクエリを作成できますが、それなしで作成する方法を知りたいです。username
user_id