Export and import your Oozie workflows

Published on 11 March 2015 in - 2 minutes read - Last modified on 06 March 2021

August 7th 2015 update: this post is now deprecated as of Hue 3.9: Exporting and importing Oozie workflows directly from the UI  

There is no handy way to import and export your Oozie workflows until Hue 4 and HUE-1660, but here is a manual workaround possible since Hue 3.8/CDH5.4 and its new Oozie Editor.

The previous methods were very error prone as they required to insert data in multiple tables at the same time. Now, there is only one record by workflow.

 

Export all workflows

./build/env/bin/hue dumpdata desktop.Document2 --indent 2 -natural-foreign --natural-primary > data.json

 

Export specific workflows

20000013 is the id you can see in the URL of the dashboard.

./build/env/bin/hue dumpdata desktop.Document2 --indent 2 -natural-foreign --natural-primary --pks=20000013 > data.json

You can specify more than one id:

--pks=20000013,20000014,20000015

 

Load the workflows

Then

/build/env/bin/hue loaddata data.json

 

Refresh the documents

Until we hit Hue 4, this step is required in order to make the imported documents appear:

./build/env/bin/hue sync_documents

 

And that's it, the dashboards with the same IDs will be refreshed with the imported ones!

 

Note:

If the document with the same id already exists in the database, just set its id to null in data.json and it will be inserted as a new document.

vim data.json

then change

"pk": 16,

to

"pk": null,

 

Note:

If using CM, export this variable in order to point to the correct database:

HUE_CONF_DIR=/var/run/cloudera-scm-agent/process/-hue-HUE_SERVER-id

echo $HUE_CONF_DIR

export HUE_CONF_DIR

Where is the most recent ID in that process directory for hue-HUE_SERVER.

or even quicker

export HUE_CONF_DIR="/var/run/cloudera-scm-agent/process/\`ls -alrt /var/run/cloudera-scm-agent/process | grep HUE | tail -1 | awk '{print $9}'\`"

 

Have any questions? Feel free to contact us on hue-user or @gethue!


comments powered by Disqus

More recent stories

26 June 2024
Integrating Trino Editor in Hue: Supporting Data Mesh and SQL Federation
Read More
03 May 2023
Discover the power of Apache Ozone using the Hue File Browser
Read More