Main Content

tablenames

List names of database tables in ApacheCassandradatabase

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 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 sourceCassandraDataSourceand a blank user name and password. TheapacheCassandrafunction returnsconnas aconnectionobject.

datasource ="CassandraDataSource";用户名="";password ="";conn = apacheCassandra(datasource,username,password);

Return the names of all database tables in the Cassandra database using the Cassandra database connection.tis 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 tableKeyspace 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"

TheKeyspacevariable indicates the keyspace. TheTablevariable indicates the name of the Cassandra database table in the corresponding keyspace.

Close the Cassandra database connection.

close(conn)

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, theemployeedatakeyspace.

Create a Cassandra database connection using the configured data sourceCassandraDataSourceand a blank user name and password. TheapacheCassandrafunction returnsconnas aconnectionobject.

datasource ="CassandraDataSource";用户名="";password ="";conn = apacheCassandra(datasource,username,password);

Return and display all database tables in theemployeedatakeyspace of the Cassandra database by using the Cassandra database connection.tis a string array that contains the names of all database tables in theemployeedatakeyspace.

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

collapse all

Apache Cassandra database connection, specified as aconnectionobject.

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

Example:"employeedata"

Data Types:char|string

Output Arguments

collapse all

数据库表名在卡桑德拉数据库中,specified as a string array or table. If you specify a keyspace in thekeyspaceinput argument, thetablenamesfunction 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, thetablenamesfunction returns a table with theKeyspaceandTablevariables. TheKeyspacevariable is a string array that contains all keyspaces in the Cassandra database. TheTablevariable is a string array that contains the names of all database tables in the Cassandra database for their corresponding keyspaces.

版本sion History

Introduced in R2021a