apInfo = db.engine.execute(
"select L.circuit_id, L.remote_id, AP_I.vlan, AP_I.color \
from leases as L, ap_info as AP_I \
where L.circuit_id = AP_I.mac_address and \
L.remote_id = '%s'; " % sm_mac_.remote_id[:17]).fetchone()
这会正确生成: (u'0a:00:3e:bb:76:54 ', u'0a:00:3e:bb:c1:f7 ', 12, 77))
我尝试表示为:
apInfo = db.session.query(LEASES, AP_INFO) \
.filter(LEASES.circuit_id == AP_INFO.mac_address)\
.filter(LEASES.remote_id == sm_mac_.remote_id[:17])\
.all ()
生成一个包含元组的列表?;[(< 0x101f039d0 处的主.LEASES 对象>,< 0x101f0e410 处的主.AP_INFO 对象>)]
试图确定如何修改 db.session 或从生成的内容中提取数据。