In hive,can we change location of managed/external table

前端 未结 2 432
南方客
南方客 2021-01-20 03:01

In hive,can we change location of managed/external table if yes how. After changing location will it behave like external table or internal table

相关标签:
2条回答
  • 2021-01-20 03:05

    yes, it's possible. And if you are looking for an external table location change, please use an alter script like below ALTER TABLE users SET LOCATION 'hdfs://hostname:port/source_folder_path'

    0 讨论(0)
  • 2021-01-20 03:14

    I tried to search this question but I didnt get a proper answer yes we can change the location of managed table if we add location

    CREATE TABLE weather (wban INT, date STRING, precip INT)
    ROW FORMAT DELIMITED
    FIELDS TERMINATED BY ‘,’
    LOCATION ‘ /hive/data/weather’;
    

    After creation we can change location by the below command

    ALTER (DATABASE|SCHEMA) database_name SET LOCATION hdfs_path
    

    Even if we change the location the table will behave as managed table only

    0 讨论(0)
提交回复
热议问题