Following example from the docs, but cannot understand why it's not working
class CCStandard(Base):
"""Codes, grade, code description, and name"""
__tablename__ = "DimCCStandard"
CCStandardKey = deferred(Column('CCStandardKey', Integer, primary_key=True))
CCStdCode = Column('CCStdCode', String)
#ccstd_info group
CCStdDesc = deferred(Column('CCStdDesc', String), group='ccstd_info')
CCStdName = deferred(Column('CCStdName', String), group='ccstd_info')
CCStdCluster = deferred(Column('CCStdCluster', String), group='ccstd_info')
@hybrid_property
def Cluster(self):
return self.CCStdCode[:1]
simple query below return "Operator 'getitem' is not supported on this expression"
a=session.query(CCStandard.Cluster)
I'm sure this column is a string, so not sure why I'm getting this. If I try a using a + operator it does work, ie:
@hybrid_property
def Cluster(self):
return self.CCStdCode + 'well this works'
Underlying database is a SQLServer. This column in question is an nvarchar.