1

選択クエリ内で 1 行のプロパティを使用しようとしています。0.7.4 & 0.7.5により可能になるはず です。動作などの簡単な操作はできますが、その他+ (inside value_at_end property)は使用できません。split()0.7.4 と 0.7.5 の更新に関しては、可能なはずです。

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)

取得エラー:

AttributeError: 'str' object has no attribute 'split': self.some_string_with_value_at_end.split (inside Foo.value_at_end)

今、私はraw_sqlを使用していますが、より多くの python を作成したかったのですが、可能でしょうか?

手伝ってくれてありがとう!

4

1 に答える 1