Support Questions

Find answers, ask questions, and share your expertise

truncate partition external table

avatar
Contributor

Hi All,

Can we truncate partition external table ?

Sharing an example where i faced the issue .

hive> truncate table abc.Stage_xact_personall_region_of_Sale partition (region_code='TYES');

FAILED: SemanticException [Error 10146]: Cannot truncate non-managed table abc.Stage_xact_personall_region_of_Sale .

Help will be much appreciated ASAP .

-Thanks

Satish

1 ACCEPTED SOLUTION
2 REPLIES 2

avatar
Contributor

Thanks a lot ..

It works

Consolidated answer

ALTER TABLE abc.Stage_xact_personall_region_of_Sale DROP PARTITION (region_code='TYES');

Then do an overwrite on it

insert overwrite table abc.Stage_xact_personall_region_of_Sale partition(region_code) select * from xyz.Region_Sale where region_code='TYES';

-Thanks

Satish