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 <[email protected]>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
>