Is the python client backward compatible with 2.x servers?

I’ve been trying to get the python client to work with a 2.x server. I’m somewhat successful because I can get keys, but scan and query both fail. Scan wanders off and never returns any rows, using 0% cpu. Query immediately give me an error.

`In [2]: import aerospike as asm

In [3]: cl = asm.client(config)

In [4]: cl = cl.connect()

In [5]: q = cl.query(‘nope’, ‘nopenope’)

In [6]: def callback((key, meta, record)): print “key: %s size: %d” (key[1],len(record)) return True …:

In [7]: q.foreach(callback)


Exception Traceback (most recent call last) in () ----> 1 q.foreach(callback)

Exception: (-1L, ‘AEROSPIKE_ERR_CLIENT’, None, None)

Yes, the Python client is backward compatible with 2.0 Server, for the KVS functionality that’s supported.

To do a scan, please try the scan() function:

    s = client.scan(namespace, set)

    if options.bins and len(options.bins) > 0:
        # project specified bins
        s.select(*options.bins)

    records = []

    # callback to be called for each record read
    def callback((key, meta, record)):
        records.append(record)
        print(record)

    # invoke the operations, and for each record invoke the callback
    s.foreach(callback)

In [2]: import aerospike as asm

In [3]: cl = asm.client(config)

In [4]: cl = cl.connect()

In [5]: sc = cl.scan(‘nope’, ‘nopenope’)

In [6]: sc.select(‘bin1’) Out[6]: <aerospike.Scan at 0x1c3a6e0>

In [7]: def callback((key, meta, record)): print “key: %s size: %d” (key[1],len(record)) return True …:

In [8]: sc.foreach(callback)

Nothing ever happens when I do the scan. It just hangs here forever, the client isn’t doing anything, there doesn’t appear to be any network traffic.

I’m not sure what I’m doing wrong?

What is the data set you are scanning? In our test bed we regularly run 30m records successfully. We have also fixed some memory leaks in the python client in 1.0.33 which you want to pick up.