hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stack <st...@duboce.net>
Subject Re: Truncate Table with API
Date Wed, 04 Mar 2009 22:34:32 GMT
Here is how it works in shell Sean (from bin/HBase.rb):

    def truncate(tableName)
      now = Time.now
      @formatter.header()
      hTable = HTable.new(tableName)
      tableDescription = hTable.getTableDescriptor()
      puts 'Truncating ' + tableName + '; it may take a while'
      puts 'Disabling table...'
      disable(tableName)
      puts 'Dropping table...'
      drop(tableName)
      puts 'Creating table...'
      @admin.createTable(tableDescription)
      @formatter.footer(now)
    end

St.Ack

On Wed, Mar 4, 2009 at 2:24 PM, Sean Laurent <organicveggie@gmail.com>wrote:

> Hi all,
> How do you truncate an entire table using the Java API? Shell has a
> TRUNCATE
> command, but I can't find any matching functionality in the API itself...
> all of the HTable.deleteAll() methods require a row-key.
>
> Any suggestions would be greatly appreciated.
>
> -Sean
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message