Tuesday, August 21, 2012

How to migrate a hive table from one hive instance to another or between hive databases


Hive has the EXPORT IMPORT feature since hive 0.8. With this feature you can export the metadata as well as the data for a corresponding table to a file in hdfs using the EXPORT command. The data is stored in json format. Data once exported this way could be imported back to another database or hive instance using the IMPORT command.

The syntax looks something like this:
EXPORT TABLE table_or_partition TO hdfs_path;
IMPORT [[EXTERNAL] TABLE table_or_partition] FROM hdfs_path [LOCATION [table_location]];

Some sample statements would look like:
EXPORT TABLE <table name> TO 'location in hdfs';

Use test_db;
IMPORT FROM 'location in hdfs';

Export Import can be appled on a partition basis as well:
EXPORT TABLE <table name> PARTITION (loc="USA") to 'location in hdfs';

The below import commands imports to an external table instead of a managed one
IMPORT EXTERNAL TABLE FROM 'location in hdfs' LOCATION ‘/location/of/external/table’;

62 comments:

  1. This is very nice article. This is very use ful for Hadoop Learners.

    ReplyDelete
  2. hadoop is new technology ,this article is very good for the beginner,i was learn hadoop from Easylearning Guru it was help me the most
    and in this there is life time support system which will help me to clear my doubt any time any where

    ReplyDelete
  3. Thanks for InformationHadoop Course will provide the basic concepts of MapReduce applications developed using Hadoop, including a close look at framework components, use of Hadoop for a variety of data analysis tasks, and numerous examples of Hadoop in action. This course will further examine related technologies such as Hive, Pig, and Apache Accumulo. HADOOP Online Training

    ReplyDelete
  4. Hadoop is really a good booming technology in coming days. And good path for the people who are looking for the Good Hikes and long career. We also provide Hadoop online training

    ReplyDelete
  5. Thanks for the post. I have a scenario where i have to dumb entire database to hive instance on different cluster (on different network). I have 100's of table in database. It's really hard to do for each. I guess i do this using python script in worst case. But i'm just curious is there any simple command like "export database dbname" ?

    ReplyDelete
  6. Pretty good post. I just came across your site and wanted to say that I’ve really enjoyed reading your posts. In any case I’ll be subscribing to your feed and I hope you will keep a good work!Cheer!

    Regards
    sap sd and crm online training
    sap online tutorials
    sap sd tutorial
    sap sd training in ameerpet
    sap crm training tutorial

    ReplyDelete
  7. I appreciate you sharing this article. Really thank you! Much obliged.
    This is one awesome blog article. Much thanks again.


    sap online training
    software online training
    sap sd online training
    hadoop online training
    sap-crm-online-training

    ReplyDelete
  8. I really enjoy the blog.Much thanks again. Really Great.
    Very informative article post. Really looking forward to read more. Will read on…



    oracle online training
    sap fico online training
    dotnet online training
    qa-qtp-software-testing-training-tutorial

    ReplyDelete
  9. Thanks for the notes that you have published here. Though it looks familiar, it's a very good approach you have implemented here. Thanks for posting content in your blog. I feel awesome to be here.

    cloud computing training institutes in chennai
    Cloud computing training
    hadoop training in chennai

    ReplyDelete
  10. That was really great blog for me thanks for sharing..

    Oracle Training in chennai

    ReplyDelete
  11. |t was good to read & I am getting some useful info's through your blog keep sharing... Informatica is an ETL tools helps to transform your old business leads into new vision. Learn Informatica Training in chennai from corporate professionals with very good experience in informatica tool.

    ReplyDelete
  12. There are lots of information about latest technology and how to get trained in them, like Hadoop Training in Chennai have spread around the web, but this is a unique one according to me.

    ReplyDelete
  13. I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly..

    Pega Training in Chennai

    ReplyDelete
  14. Thanks for sharing this nice useful informative post to our knowledge..

    QTP Training in Chennai

    ReplyDelete
  15. Your blog is really awesome and I got some useful information from your blog. This is really useful for me. Thanks for sharing such a informative blog. Keep posting.

    SAS Training in Chennai

    ReplyDelete
  16. The information you posted here is useful to make my career better keep updates...

    Green Technologies In Chennai Green Technologies In Chennai

    ReplyDelete
  17. Thanks for sharing this niche useful informative post to our knowledge, Actually SAP is ERP software that can be used in many companies for their day to day business activities it has great scope in future.
    Regards,
    SAP course in chennai|
    SAP Training in Chennai|SAP Training Chennai

    ReplyDelete
  18. GREENS TECHNOLOGIES, ONE OF THE BEST IT INSTITUTES FOR ORACLE SQL TRAINING IN CHENNAI OFFERS TRAINING WITH PRACTICAL GUIDANCE. OUR TRAINING ACADEMY IS FULLY EQUIPPED WITH SUPERIOR INFRASTRUCTURE AND LAB FACILITIES. WE ARE PROVIDING THE BEST ORACLE PLSQL TRAINING IN CHENNAI.

    ReplyDelete
  19. Greens Technologies Training In Chennai
    Excellent information with unique content and it is very useful to know about the information based on blogs

    ReplyDelete
  20. Thanks for sharing this nice useful informative post to our knowledge, Actually SAS used in many companies for their day to day business activities it has great scope in future.

    ReplyDelete
  21. Our HP Quick Test Professional course includes basic to advanced level and our QTP course is designed to get the placement in good MNC companies in chennai as quickly as once you complete the QTP certification training course.

    ReplyDelete
  22. A Best Pega Training course that is exclusively designed with Basics through Advanced Pega Concepts.With our Pega Training in Chennai you’ll learn concepts in expert level with practical manner.We help the trainees with guidance for Pega System Architect Certification and also provide guidance to get placed in Pega jobs in the industry.

    ReplyDelete
  23. Great post and informative blog.it was awesome to read, thanks for sharing this great content to my vision.Informatica Training In Chennai

    ReplyDelete
  24. There are lots of information about latest technology and how to get trained in them, like Hadoop Training Chennai have spread around the web, but this is a unique one according to me. The strategy you have updated here will make me to get trained in future technologies(Hadoop Training in Chennai). By the way you are running a great blog. Thanks for sharing this

    ReplyDelete
  25. Oracle Training in Chennai is one of the best oracle training institute in Chennai which offers complete Oracle training in Chennai by well experienced Oracle Consultants having more than 12+ years of IT experience.

    ReplyDelete
  26. It is really very helpful for us and I have gathered some important information from this blog.Oracle Training In Chennai

    ReplyDelete

  27. If wants to get real time Oracle Training visit this blog They give professional and job oriented training for all students.To make it easier for you Greens Technologies trained as visualizing all the real-world Application and how to implement in Archiecture trained with expert trainners guide may you want.. Start brightening your career with us Green Technologies In Chennai

    ReplyDelete
  28. Nice site....Please refer this site also nice if Our vision succes!Training are focused on perfect improvement of technical skills for Freshers and working professional. Our Training classes are sure to help the trainee with COMPLETE PRACTICAL TRAINING and Realtime methodologies Green Technologies In Chennai

    ReplyDelete
  29. I also wanted to share few links related to sas training Check this sitete.if share indepth sas training.Go here if you’re looking for information on sas training. SAS Training in Chennai

    ReplyDelete
  30. This site has very useful inputs related to qtp.This page lists down detailed and information about QTP for beginners as well as experienced users of QTP. If you are a beginner, it is advised that you go through the one after the other as mentioned in the list. So let’s get started… QTP Training in Chennai

    ReplyDelete
  31. Hi. Nice post. I am wondering if it is possible.Actually pega software that can be used in many companies for their day to day business activities it has great scope in future.if suggest best coaching center visit Pega Training in Chennai

    ReplyDelete
  32. fantastic presentation of informatica..if sharinng this session will describe near real-time architectures for accelerating the delivery of data to critical analytics and customer service applications in real world once again i want to share this sites Informatica Training in chennai

    ReplyDelete
  33. Hey, nice site you have here!We provide world-class Oracle certification and placement training course as i wondered Keep up the excellent work experience!Please visit Greens Technologies located at Chennai Adyar Oracle Training in chennai

    ReplyDelete
  34. if share valuable information about hadoop training courses, certification, online resources, and private training for Developers, Administrators, and Data Analysts may visit Hadoop Training in Chennai

    ReplyDelete
  35. Hey, nice site you have here!We provide world-class Oracle certification and placement training course as i wondered Keep up the excellent work experience!Please visit Greens Technologies located at Chennai Adyar Oracle Training in chennai

    ReplyDelete
  36. I would recommend the Qlikview course to anyone interested in learning Business Intelligence .Absolutely professional and engaging training sessions helped me to appreciate and understand the technology better. thank you very much if our dedicated efforts and valuable insights which made it easy for me to understand the concepts taught and more ... qlikview Training in chennai

    ReplyDelete
  37. Thanks for sharing this informative blog .To make it easier for you Greens Techonologies at Chennai is visualizing all the materials about (OBIEE).SO lets Start brightening your future.and using modeling tools how to prepare and build objects and metadata to be used in reports and more trained itself visit Obiee Training in chennai

    ReplyDelete
  38. hai you have to learned to lot of information about c# .net Gain the knowledge and hands-on experience you need to successfully design, build and deploy applications with c#.net.
    C-Net-training-in-chennai

    ReplyDelete

  39. hai If you are interested in asp.net training, our real time working.
    asp.net Training in Chennai.
    Asp-Net-training-in-chennai.html

    ReplyDelete


  40. Amazing blog if our training additional way as an silverlight training trained as individual, you will be able to understand other applications more quickly and continue to build your skill set which will assist you in getting hi-tech industry jobs as possible in future courese of action..visit this blog
    silverlight-training.html
    greenstechnologies.in:

    ReplyDelete
    Replies
    1. Thanks The information which you provided is very much useful for Hybris Training v

      Delete
  41. Thanks The information which you provided is very much useful for Pega Training v

    ReplyDelete
  42. Thank you very much for providing latest salesforce online training.You can search and visit our website.with best regards:
    salesforce online training

    ReplyDelete
  43. Really awesome blog. Your blog is really useful for me. Thanks for sharing this informative blog. Keep update your blog.
    QTP Training in Chennai

    ReplyDelete
  44. Really awesome blog. Your blog is really useful for me. Thanks for sharing this informative blog. Keep update your blog.
    QTP Training in Chennai

    ReplyDelete
  45. Excellent information with unique content and it is very useful to know about the information based on blogs.
    Selenium Training in Chennai | QTP Training In Chennai

    ReplyDelete
  46. This comment has been removed by the author.

    ReplyDelete
  47. Way cool! Some extremely valid points! I appreciate you penning this write-up and also the rest of the website is really good.
    Hadoop Online Training

    ReplyDelete
  48. When I originally commented I seem to have clicked the -Notify me when new comments are added- checkbox and now whenever a comment is added I receive 4 emails with the same comment. Is there a means you are able to remove me from that service? Thanks!
    SAP APO Online Training

    ReplyDelete
  49. Thank you,so thank of this tutorial! Hope you have more the lession like this!AWS Training
    Thank agains!

    ReplyDelete
  50. Thanks for nice topic. It’s a very wonderful excellent topic. We are providing online Training Classes. HADOOP ONLINE TRAINING

    ReplyDelete
  51. very nice article on Big Data. With the explosion of big data, companies are faced with data challenges in three different areas. hadoop online training

    ReplyDelete
  52. Heya¡­my very first comment on your site. ,I have been reading your blog for a while and thought I would completely pop in and drop a friendly note. . It is great stuff indeed. I also wanted to ask..is there a way to subscribe to your site via email?



    Hadoop Training in Chennai

    ReplyDelete
  53. nice posts migrate..
    SAS Institute introduced the SAS Certified Professional Program,training proper understanding of how the SAS software works.
    SAS online training in hyderabad

    ReplyDelete