Search code examples
pythonaerospike

What is the easiest way to check if aerospike set is empty from python?


I don't see a method in a Python client which checks if the given set is empty.

As documentation says from the command line I can use:

asinfo -h <host> -v 'sets/<namespace>/<set>'

but it is for a single host only.

Another way is to look at the output of:

asadm -h <host> -e 'info set'

How would you implement such a method in Python?


Solution

  • Use the "info" API in the client: https://www.aerospike.com/apidocs/python/client.html#aerospike.Client.info_all

    client.info_all("sets/<namespace>/<set>")
    

    Then sum the stat you are interested.