I'm trying to use one-line property inside select query. It should be possible due to
0.7.4 & 0.7.5.
Simple operation such as + (inside value_at_end property)
works but I'm not able to use split()
and other. Regarding 0.7.4 and 0.7.5 update it should be possible.
class Foo(db.Entity):
_table_ = "sample_table"
some_string_with_value_at_end = Optional(str)
@property
def value_at_end(self):
return self.some_string_with_value_at_end.split('/')[-1]
@classmethod
def get_values_at_end(cls):
values = select(v.value_at_end for v in cls)
return values
items = Foo.get_values_at_end()
for each in items:
print(each)
Getting error:
AttributeError: 'str' object has no attribute 'split': self.some_string_with_value_at_end.split (inside Foo.value_at_end)
Right now I'm using raw_sql but wanted to make more python, it should be possible?
Thanks for help!