This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

tablenames

List names of database tables in Apache Cassandra database

Syntax

t = tablenames(conn)
t = tablenames(conn,keyspace)

Description

example

t = tablenames(conn) returns a list that contains the names of Cassandra® database tables and their corresponding keyspaces of the Cassandra database.

example

t = tablenames(conn,keyspace) returns a list that contains the names of Cassandra database tables in the specified keyspace of the Cassandra database.

Examples

collapse all

Using a Cassandra® database connection, return the names of all database tables in the Cassandra database.

Create a Cassandra database connection using the local host address. conn is a cassandra object.

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

Return the names of all database tables in the Cassandra database using the Cassandra database connection. t is a table that contains the names of all Cassandra database tables and their corresponding keyspaces.

t = tablenames(conn);

Display the first few rows of the returned data.

head(t)
ans=8×2 table
       Keyspace                 Table           
    ______________    __________________________

    "employeedata"    "employees_by_job"        
    "employeedata"    "employees_by_id"         
    "employeedata"    "employees_by_name"       
    "system"          "built_views"             
    "system"          "sstable_activity"        
    "system"          "views_builds_in_progress"
    "system"          "compaction_history"      
    "system"          "hints"                   

The Keyspace variable indicates the keyspace. The Table variable indicates the name of the Cassandra database table in the corresponding keyspace.

Close the Cassandra database connection.

close(conn)

Using a Cassandra® database connection, return the names of all database tables in a specific keyspace of the Cassandra database—in this case, the employeedata keyspace.

Create a Cassandra database connection using the local host address. conn is a cassandra object.

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

Return and display all database tables in the employeedata keyspace of the Cassandra database by using the Cassandra database connection. t is a string array that contains the names of all database tables in the employeedata keyspace.

keyspace = "employeedata";
t = tablenames(conn,keyspace)
t = 3×1 string array
    "employees_by_job"
    "employees_by_id"
    "employees_by_name"

Close the Cassandra database connection.

close(conn)

Input Arguments

collapse all

Cassandra database connection, specified as a cassandra object.

Keyspace, specified as a character vector or string scalar. If you do not know the keyspace, then access the Keyspaces property of the cassandra object using dot notation to view the keyspaces in the Cassandra database.

Example: "employeedata"

Data Types: char | string

Output Arguments

collapse all

Database table names in the Cassandra database, specified as a string array or table. If you specify a keyspace in the keyspace input argument, the tablenames function returns a string array that contains all the database table names in the specified keyspace of the Cassandra database. If you do not specify a keyspace, the tablenames function returns a table with the Keyspace and Table variables. The Keyspace variable is a string array that contains all keyspaces in the Cassandra database. The Table variable is a string array that contains the names of all database tables in the Cassandra database for their corresponding keyspaces.

Introduced in R2018b