I am trying to solve a challenge I am facing and feel an answer to this would steer me in the right direction,further to what has been done here,
how would the code look if one was looking to return two columns instead of just one.
for example name and age.
For people new to python looking at this later; @owen.campbell 's list comprehension is a shortened form that is easier to write. If it were written without comprehensions it would probably look like:
result = []
for r in app_tables.my_table.search():
result.append( { 'name' : r['name'], 'age' : r['age'] } )
This may do the same thing, but will not be executed by the python runtime compiler the exact same way. Also note that I had to choose to either write the keys twice or do another loop, either of which is… inelegant in comparison to the comprehension.