[Answered ]-Get field name from an object retrieved by orm query

2👍

I think this is what you want–for each returned row it will print the matched fields, indented:

fields = ('fps', 'sps', 'tps', 'fpp', 'spp', 'tpp')
for r in results.values():
    print 'Row with id=%s:' % r['id']
    for f in fields:
        if word_name in str(r[f]):
            print '  Field %s matches' % f

Edited to account for non-string values and to look only at the desired fields.

Leave a comment