Nirali Kavar
Nirali Kavar

Reputation: 976

How can i describe table in cassandra database?

$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 ?

Upvotes: 15

Views: 45545

Answers (2)

Vijay
Vijay

Reputation: 5010

Try desc table keyspace.tablename;

Upvotes: 1

Chris Lohfink
Chris Lohfink

Reputation: 16400

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

Upvotes: 22

Related Questions