Re: [Sqlalchemy-tickets] [sqlalchemy] #2810: Single Item support for Association Proxy
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2013-08-26 15:43:48
|
#2810: Single Item support for Association Proxy
----------------------------------+------------------------------------
Reporter: jonathan | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: cextensions | Severity: no triage selected yet
Resolution: | Keywords:
Progress State: awaiting triage |
----------------------------------+------------------------------------
Comment (by zzzeek):
and there we have it
{{{
#!python
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.associationproxy import association_proxy
Base = declarative_base()
class A(Base):
__tablename__ = 'a'
id = Column(Integer, primary_key=True)
bs = relationship("B", uselist=False)
bname = association_proxy("bs", "name")
class B(Base):
__tablename__ = 'b'
id = Column(Integer, primary_key=True)
a_id = Column(Integer, ForeignKey('a.id'))
name = Column(String)
a1 = A()
assert a1.bname is None
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2810#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|