%% Return Column Information from Cassandra Database Table
% Using a Cassandra® database connection, return column information for a Cassandra database table. Specify the keyspace and the name of the table. In this case, the Cassandra database has the employeedata keyspace, which contains the employees_by_job database table.
%
% Create a Cassandra database connection using the local host address. conn is a cassandra object.

contactPoints = "localhost";
conn = cassandra(contactPoints);

%
% Return column information for the employees_by_job database table in the employeedata keyspace.

keyspace = "employeedata";
tablename = "employees_by_job";
cols = columninfo(conn,keyspace,tablename);

%
% Display the first few rows of column information.

head(cols)

% cols is a table with these variables:
% Name — Cassandra database column name
% DataType — Cassandra Query Language (CQL) data type of the Cassandra database column
% PartitionKey — Partition key indicator
% ClusteringColumn — Clustering column indicator
%
% Close the Cassandra database connection.

close(conn)

% Copyright 2018 The MathWorks, Inc.