Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i describe table in cassandra database?

Tags:

cql

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

i used above code but it is not working. how can i fetch field name and it's data type from Cassandra table ?

like image 334
Nirali Kavar Avatar asked Oct 15 '15 10:10

Nirali Kavar


1 Answers

Refer to CQL documentation. Describe expects a table/schema/keyspace.

describe table keyspace.tablename

Its also a cqlsh command, not an actual cql command. To get this information query the system tables. try

select * from system.schema_columns;

- or for more recent versions -

select * from system_schema.columns ;

if using php driver may want to check out http://datastax.github.io/php-driver/features/#schema-metadata

like image 199
Chris Lohfink Avatar answered Jan 15 '23 15:01

Chris Lohfink