tablenames
Description
Examples
Return Database Table Names in Cassandra Database
Using a Cassandra® database connection and the Apache™ Cassandra database C++ interface, return the names of all database tables in the Cassandra database.
Create a Cassandra database connection using the configured data source CassandraDataSource
and a blank user name and password. The apacheCassandra
function returns conn
as a connection
object.
datasource = "CassandraDataSource"; username = ""; password = ""; conn = apacheCassandra(datasource,username,password);
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_id"
"employeedata" "employees_by_job"
"employeedata" "employees_by_name"
"system" "IndexInfo"
"system" "available_ranges"
"system" "batches"
"system" "batchlog"
"system" "built_views"
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)
Return Database Table Names in Cassandra Database Keyspace
Using an Apache™ Cassandra® database connection and the Apache Cassandra database C++ interface, 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 configured data source CassandraDataSource
and a blank user name and password. The apacheCassandra
function returns conn
as a connection
object.
datasource = "CassandraDataSource"; username = ""; password = ""; conn = apacheCassandra(datasource,username,password);
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
"employees_by_id"
"employees_by_job"
"employees_by_name"
Close the Cassandra database connection.
close(conn)
Input Arguments
conn
— Apache Cassandra database connection
connection
object
Apache Cassandra database connection, specified as a connection
object.
keyspace
— Keyspace
character vector | string scalar
Keyspace, specified as a character vector or string scalar. If you do not know the keyspace, then access the Keyspaces
property of the connection
object using dot notation to view the keyspaces in the Cassandra database.
Example: "employeedata"
Data Types: char
| string
Output Arguments
t
— Database table names
string array | table
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.
Version History
Introduced in R2021a
See Also
Objects
Functions
apacheCassandra
|columninfo
|partitionRead
|upsert
|executecql
|close
External Websites
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)