Hello world,
I am working my way through the content here:
http://www.aerospike.com/docs/client/python/usage/query/query.html
I have a simple script which works well:
import pdb
import aerospike
config = {'hosts': [('127.0.0.1',3000)]}
client = aerospike.client(config).connect()
mynamspace = 'test'
myset = 'dogs'
myrecname = 'Fred'
myrecpk = 100
foodbin = 'Fred likes catfood'
agebin = 4
myrecord = {'myrecname': myrecname, 'myrecpk': myrecpk, 'foodbin': foodbin, 'agebin': agebin}
keytuple = (mynamspace,myset,myrecpk)
client.put(keytuple, myrecord)
query = client.query(mynamspace,myset)
def print_result((key, metadata, record)):
print(key, metadata, record)
query.foreach(print_result)
qsel = query.select('foodbin', 'agebin')
But when I add the following line, the script fails:
qsel.foreach(print_result)
Questions:
Why did it fail?
How do I print qsel results?