Michael had helped me in the past to get read only columns defined like
this:
## old model non declarative
##class Quality(OrmObject):
## def comboname(self):
## return self._comboname
## comboname = property(comboname)
##
##quality = sao.mapper(Quality, quality_table,
## properties={
## '_comboname': quality_table.c.comboname,
## 'comboname': sao.synonym('_comboname'),
I tried to translate this based on the declarative doc (BTW, there is a
typo on synonym_for it is shown as synonyn_for, i.e. an "n" instead of
the "m" and came up with this:
class Quality(Base):
__table__ = sa.Table(u'quality', metadata,
...
sa.Column(u'comboname', sa.String(length=63, convert_unicode=False),
server_default=""),
...
)
# read only columns
_comboname = sao.column_property(__table__.c.comboname)
@sad.synonym_for('_comboname')
@property
def comboname(self):
return self._comboname
When reading from Quality I do not see the comboname column but I also
do not get any error.
Would appreciate if someone can put me right.
Best regards
Werner
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---