cassandracqlengine

Can i do 'DESCRIBE KEYSPACES' from cqlengine?


I'm using cqlengine from Django. Is there a way to make DESCRIBE KEYSPACES from it. It works form cqlsh. Couldn't find anything in Docs


Solution

  • Best bet is getting it from the cluster metadata. DESCRIBE is not part of cql but cqlsh is using the python driver just like cqlengine so you can use same mechanism:

    https://github.com/apache/cassandra/blob/16490a48b02b6f206a78717e9b816983f0b76bb1/bin/cqlsh.py#L619

    map(str, yourconnection.metadata.keyspaces.keys())
    

    from the metadata you can collect most data you want like this. You can also query the system schema tables but that changes between versions a bit so I would recommend letting driver do it for you.