Package alluxio.cli.table.command
Class ListDatabasesCommand
- java.lang.Object
-
- alluxio.cli.table.command.AbstractTableCommand
-
- alluxio.cli.table.command.ListDatabasesCommand
-
- All Implemented Interfaces:
alluxio.cli.Command,java.io.Closeable,java.lang.AutoCloseable
public class ListDatabasesCommand extends AbstractTableCommand
List information about attached databases and tables in the Alluxio catalog. This command has similar function to what aSHOW TABLESorSHOW DATABASESquery would return but makes it easier to query on a local machine what the Alluxio catalog currently stores without needing to boot up a presto instance.
-
-
Field Summary
-
Fields inherited from class alluxio.cli.table.command.AbstractTableCommand
mClient, mConf
-
-
Constructor Summary
Constructors Constructor Description ListDatabasesCommand(alluxio.conf.AlluxioConfiguration conf, alluxio.client.table.TableMasterClient client)Creates a new instance ofListDatabasesCommand.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetCommandName()java.lang.StringgetDescription()java.lang.StringgetUsage()intlistDatabases()Print attached databases to stdout.intlistTable(java.lang.String db, java.lang.String tableName)Print table information to stdout.intlistTables(java.lang.String db)Print list of tables stdout.intrun(org.apache.commons.cli.CommandLine cl)voidvalidateArgs(org.apache.commons.cli.CommandLine cl)
-
-
-
Constructor Detail
-
ListDatabasesCommand
public ListDatabasesCommand(alluxio.conf.AlluxioConfiguration conf, alluxio.client.table.TableMasterClient client)Creates a new instance ofListDatabasesCommand.- Parameters:
conf- alluxio configurationclient- the table master client
-
-
Method Detail
-
getCommandName
public java.lang.String getCommandName()
- Specified by:
getCommandNamein interfacealluxio.cli.Command- Specified by:
getCommandNamein classAbstractTableCommand
-
getDescription
public java.lang.String getDescription()
-
getUsage
public java.lang.String getUsage()
-
validateArgs
public void validateArgs(org.apache.commons.cli.CommandLine cl) throws alluxio.exception.status.InvalidArgumentException- Specified by:
validateArgsin interfacealluxio.cli.Command- Specified by:
validateArgsin classAbstractTableCommand- Throws:
alluxio.exception.status.InvalidArgumentException
-
run
public int run(org.apache.commons.cli.CommandLine cl) throws alluxio.exception.AlluxioException, java.io.IOException- Specified by:
runin interfacealluxio.cli.Command- Specified by:
runin classAbstractTableCommand- Throws:
alluxio.exception.AlluxioExceptionjava.io.IOException
-
listDatabases
public int listDatabases() throws alluxio.exception.status.AlluxioStatusException, java.io.IOExceptionPrint attached databases to stdout.- Returns:
- 0 on success, any non-zero value otherwise
- Throws:
alluxio.exception.status.AlluxioStatusExceptionjava.io.IOException
-
listTables
public int listTables(java.lang.String db) throws alluxio.exception.status.AlluxioStatusExceptionPrint list of tables stdout.- Parameters:
db- the database to list the tables of- Returns:
- 0 on success, any non-zero value otherwise
- Throws:
alluxio.exception.status.AlluxioStatusException
-
listTable
public int listTable(java.lang.String db, java.lang.String tableName) throws alluxio.exception.status.AlluxioStatusExceptionPrint table information to stdout.- Parameters:
db- the database the table exists intableName- the name of the table to dump information for- Returns:
- 0 on success, any non-zero value otherwise
- Throws:
alluxio.exception.status.AlluxioStatusException
-
-