Class TableCommands

java.lang.Object
com.mapr.db.shell.commands.ShellCommands
com.mapr.db.shell.commands.TableCommands
All Implemented Interfaces:
org.springframework.shell.core.CommandMarker, org.springframework.shell.core.ExecutionProcessor

@Component public class TableCommands extends ShellCommands
  • Constructor Details

  • Method Details

    • isDMLAvailable

      @CliAvailabilityIndicator({"find","insert","delete","exists","create","drop","list","desc"}) public boolean isDMLAvailable()
    • exists

      @CliCommand(value="exists", help="Returns true if the table exists.") public void exists(@CliOption(key={"","path","p"},mandatory=true,help="Table path.") String path) throws IOException
      Throws:
      IOException
    • list

      @CliCommand(value="list", help="Lists all tables in a folder or matching the specified pattern.") public void list(@CliOption(key={"","p","patternOrPath"},help="A path and/or a file pattern.") String patternOrPath) throws IOException
      Throws:
      IOException
    • desc

      @CliCommand(value="desc", help="Describes the properties of a table.") public void desc(@CliOption(key={"","t","table"},mandatory=true,help="Table path.") String tablePath) throws IOException
      Throws:
      IOException
    • create

      @CliCommand(value="create", help="Create a json table at the given path.") public void create(@CliOption(key={"","t","table"},mandatory=true,help="Table path.") String tablePath) throws IOException
      Throws:
      IOException
    • drop

      @CliCommand(value="drop", help="Deletes a MapR-DB json table.") public void drop(@CliOption(key={"","t","table"},mandatory=true,help="Table path.") String tablePath) throws IOException
      Throws:
      IOException
    • insert

      @CliCommand(value="insert", help="Inserts or replaces a document into the table.", examples={"insert /tables/users --value \'{\"_id\":\"user001\" , \"first_name\":\"John\", \"last_name\":\"Doe\"}\'","insert /tables/users --id user002 --value \'{\"first_name\":\"Jane\", \"last_name\":\"Dane\"}\'"}) public void insert(@CliOption(key={"","t","table"},mandatory=true,help="Table path.") String tablePath, @CliOption(key="id",help="Document Id.") String _id, @CliOption(key={"v","value"},mandatory=true,help="Json document to insert or replace.") String jsonStr, @CliOption(key={"c","where"},mandatory=false,help="Condition in JSON format") String conditionString) throws IOException
      Throws:
      IOException
    • replace

      @CliCommand(value="replace", help="Replace a document based on condition.", examples="replace /tables/users --id user002 --value \'{\"first_name\":\"Jane\", \"last_name\":\"Doe\"}\'") public void replace(@CliOption(key={"","t","table"},mandatory=true,help="Table path.") String tablePath, @CliOption(key="id",help="Document Id.") String _id, @CliOption(key={"v","value"},mandatory=true,help="Json document to insert or replace.") String jsonStr, @CliOption(key={"c","where"},mandatory=false,help="Condition in JSON format") String conditionString) throws IOException
      Throws:
      IOException
    • get

      @CliCommand(value="findbyid", help="Retrieves a single document from the table.", examples="findbyid /tables/users --id user001") public void get(@CliOption(key={"","table","t"},mandatory=true,help="Table path.") String tablePath, @CliOption(key="id",mandatory=true,help="Document Id.") String _id, @CliOption(key={"c","where"},help="Condition in JSON format") String conditionString, @CliOption(key={"f","fields"},help="Projections in JSON documents") String projectionString, @CliOption(key={"withtags","withTags"},help="Enables/disables printing with extended Type Tags.",specifiedDefaultValue="true") String withTags, @CliOption(key="pretty",help="Enables/disables pretty printing of the document.",specifiedDefaultValue="true") String pretty) throws IOException
      Throws:
      IOException
    • find

      @CliCommand(value="find", help="Retrieves one or more documents from the table.", examples={"find /tables/users","find /tables/users --fromid user001 --toid user00a --limit 32"}) public void find(@CliOption(key={"","t","table"},mandatory=true,help="Table path.") String tablePath, @CliOption(key={"indexName","indexname"},hidden=true) String indexName, @CliOption(key="id",help="Document Id.") String _id, @CliOption(key="fromid",help="Document Id to start from (inclusive)") String fromId, @CliOption(key="toid",help="Document Id to stop at (exclusive)") String toId, @CliOption(key="limit",help="Maximum number of documents to return.") String limit, @CliOption(key={"withtags","withTags"},help="Enables/disables printing with extended Type Tags.",specifiedDefaultValue="true") String withTags, @CliOption(key="pretty",help="Enables/disables pretty printing of the document.",specifiedDefaultValue="true") String pretty, @CliOption(key="offset",help="Skip first n number of rows in the result.") String offset, @CliOption(key="orderby",help="Sort result by the given fields.") String orderby, @CliOption(key={"c","where"},help="Condition in JSON format") String conditionString, @CliOption(key={"f","fields"},help="Projections in JSON documents") String projectionString, @CliOption(key={"q","query"},mandatory=false,help="Query in JSON documents") String queryString) throws IOException, OperationNotSupportedException
      Throws:
      IOException
      OperationNotSupportedException
    • indexlist

      @CliCommand(value="indexlist", help="Retrieves the list of indexes for the specified table.", hidden=false, examples="indexlist /tables/users") public void indexlist(@CliOption(key={"","t","table"},mandatory=true,help="Table path.") String tablePath)
    • indexscan

      @CliCommand(value="indexscan", help="Scan the index and return the document in their natural order.", hidden=false, examples={"indexscan /table --indexname idx --limit 7","indexscan /table --indexname idx --mode err"}) public void indexscan(@CliOption(key={"","t","table"},mandatory=true,help="Table path.") String tablePath, @CliOption(key={"indexname","indexName"},mandatory=true,help="Name of the index.") String indexName, @CliOption(key="limit",help="Maximum number of documents to return.") String limit, @CliOption(key={"withtags","withTags"},help="Enables/disables printing with extended Type Tags.",specifiedDefaultValue="true") String withTags, @CliOption(key="pretty",help="Enables/disables pretty printing of the document.",specifiedDefaultValue="true") String pretty, @CliOption(key="mode",help="Scan mode, currently support error scan with --mode err") String mode, @CliOption(key={"c","where"},help="Condition in JSON format") String queryString, @CliOption(key={"f","fields"},help="Projections in JSON documents") String projectionString, @CliOption(key="decodeindexedfields",help="Decode all indexed fields into a special array",specifiedDefaultValue="false") String decodeIndexedFields) throws IOException
      Throws:
      IOException
    • delete

      @CliCommand(value="delete", help="Delete a document from the table.") public void delete(@CliOption(key={"","t","table"},mandatory=true,help="Table path.") String tablePath, @CliOption(key="id",mandatory=true,help="Document Id.") String id, @CliOption(key={"c","where"},mandatory=false,help="Condition in JSON format") String conditionString) throws IOException
      Throws:
      IOException
    • update

      @CliCommand(value="update", help="Update field in a single document.") public void update(@CliOption(key={"","t","table"},mandatory=true,help="Table path.") String tablePath, @CliOption(key="id",mandatory=true,help="Document Id.") String _id, @CliOption(key={"m","mutation"},mandatory=true,help="Json document containing field and their values.") String kvs, @CliOption(key={"c","where"},mandatory=false,help="Condition in JSON format") String conditionString) throws IOException
      Throws:
      IOException