Postby tlovan » Wed Dec 04, 2013 12:01 am Hi,
Is there a plan to update Python client to use all Aerospike3 features, like query operations, etc?
Thank you
Postby tlovan » Wed Dec 04, 2013 12:01 am Hi,
Is there a plan to update Python client to use all Aerospike3 features, like query operations, etc?
Thank you
Aerospike Python client is now out with the latest features. Please see http://www.aerospike.com/docs/client/python/
Hi,
I installed Aerospike server 3.4.0 and the latest python client on ubuntu 12.04.3. I managed to follow instructions from the client manual http://www.aerospike.com/docs/client/python/
Now I have an aerospike cluster running with 1M objects in a Namespace “test”, on a set “testNew” and I’m trying to execute some queries on it.
My script is the following :
import aerospike
conf = {'hosts': [ ('127.0.0.1', 3000) ] }
C = aerospike.client(conf).connect()
Q = C.query('test', 'testNew')
Q.select('zip', 'cty')
def show( (k, m, r) ):
print r
Q.foreach(show)
and the result is :
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
Exception: (-1L, 'AEROSPIKE_ERR_CLIENT', None, None)
But when trying the same code using “scan” instead of “query”
S = C.scan('test', 'testNew')
S.select('zip', 'cty')
S.foreach(show)
it works fine.
Unfortunately, there is no “where” option on Scan so I cannot limit the output to specific records only.
Any idea about this error ?
Thanks
There will not be a where for the scan() method, because scans don’t take predicates, while queries do. What is missing from your query is a predicate, which is why you are seeing a client error status.
This should work:
import aerospike
from aerospike import predicates as p
conf = {'hosts': [ ('127.0.0.1', 3000) ] }
C = aerospike.client(conf).connect()
Q = C.query('test', 'testNew')
Q.where(p.equals('zip', 94043))
Q.select('zip', 'cty')
def show( (k, m, r) ):
print r
Q.foreach(show)
In general, if you see unexpected behavior please open an issue in the GitHub repository: aerospike/aerospike-client-python/issues/. We are open source, so we need and appreciate good bug reports.
We are moving toward having all the features in the Python client. Last week 1.0.33 added batch operations (among other things), and yesterday 1.0.34 added several bin operations and record multi-ops. We will continue to push releases at a faster rate now, and better documentation is coming as well.
Thanks