Class 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 a SHOW TABLES or SHOW DATABASES query 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.
    • Constructor Summary

      Constructors 
      Constructor Description
      ListDatabasesCommand​(alluxio.conf.AlluxioConfiguration conf, alluxio.client.table.TableMasterClient client)
      Creates a new instance of ListDatabasesCommand.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getCommandName()  
      java.lang.String getDescription()  
      java.lang.String getUsage()  
      int listDatabases()
      Print attached databases to stdout.
      int listTable​(java.lang.String db, java.lang.String tableName)
      Print table information to stdout.
      int listTables​(java.lang.String db)
      Print list of tables stdout.
      int run​(org.apache.commons.cli.CommandLine cl)  
      void validateArgs​(org.apache.commons.cli.CommandLine cl)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface alluxio.cli.Command

        close, getOptions, getSubCommands, hasSubCommand, parseAndValidateArgs
    • Constructor Detail

      • ListDatabasesCommand

        public ListDatabasesCommand​(alluxio.conf.AlluxioConfiguration conf,
                                    alluxio.client.table.TableMasterClient client)
        Creates a new instance of ListDatabasesCommand.
        Parameters:
        conf - alluxio configuration
        client - the table master client
    • Method Detail

      • getCommandName

        public java.lang.String getCommandName()
        Specified by:
        getCommandName in interface alluxio.cli.Command
        Specified by:
        getCommandName in class AbstractTableCommand
      • 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:
        validateArgs in interface alluxio.cli.Command
        Specified by:
        validateArgs in class AbstractTableCommand
        Throws:
        alluxio.exception.status.InvalidArgumentException
      • run

        public int run​(org.apache.commons.cli.CommandLine cl)
                throws alluxio.exception.AlluxioException,
                       java.io.IOException
        Specified by:
        run in interface alluxio.cli.Command
        Specified by:
        run in class AbstractTableCommand
        Throws:
        alluxio.exception.AlluxioException
        java.io.IOException
      • listDatabases

        public int listDatabases()
                          throws alluxio.exception.status.AlluxioStatusException,
                                 java.io.IOException
        Print attached databases to stdout.
        Returns:
        0 on success, any non-zero value otherwise
        Throws:
        alluxio.exception.status.AlluxioStatusException
        java.io.IOException
      • listTables

        public int listTables​(java.lang.String db)
                       throws alluxio.exception.status.AlluxioStatusException
        Print 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.AlluxioStatusException
        Print table information to stdout.
        Parameters:
        db - the database the table exists in
        tableName - the name of the table to dump information for
        Returns:
        0 on success, any non-zero value otherwise
        Throws:
        alluxio.exception.status.AlluxioStatusException