>>> str(db.session.query(cls))
Out[1]: 'SELECT asset_tmp4test.id, asset_tmp4test.create_time, asset_tmp4test.last_update'
此時沒有 Form asset_tmp4test
狈惫,直接使用with_entities
會報錯
>>> str(db.session.query(cls).filter_by(status="active")))
Out[4]: 'SELECT asset_tmp4test.id AS asset_tmp4test_id, asset_tmp4test.create_time AS asset_tmp4test_create_time, asset_tmp4test.last_update AS asset_tmp4test_last_update, asset_tmp4test.`status` AS asset_tmp4test_status,
FROM asset_tmp4test'
加任意filter_by
后會有 FROM
語句。
記錄一下