How can I describe a table in a cassandra database?

$describe = new Cassandra\SimpleStatement(<<<EOD
             describe keyspace.tablename
EOD
    );
    $session->execute($describe);

I used the code above, but it does not work. How can I get the name of the field and its data type from the Cassandra table?

+4
source share
2 answers

Refer to the CQL documentation. Describe if the table / schema / keyspace is expecting.

describe table keyspace.tablename

Its also a cqlsh command, not the actual cql command. Request system tables to get this information. try

select * from system.schema_columns;

- or for more recent versions -

select * from system_schema.columns ;

if php driver might want to check http://datastax.imtqy.com/php-driver/features/#schema-metadata

+8
source

Try desc table keyspace.tablename;

0
source

Source: https://habr.com/ru/post/1611754/


All Articles