# Example of Running Presto and Hive Jobs in Coordination Within Workflow ## Prerequisites 1. Download the sample project ```bash cd ~/Downloads curl -o nasdaq_analysis.zip \ -L https://gist.github.com/danielnorberg/f839e5f2fd0d1a27d63001f4fd19b947/raw/d2d6dd0e3d419ea5d18b1c1e7ded9ec106c775d4/nasdaq_analysis.zip ``` 1. Extract the downloaded project ```bash unzip nasdaq_analysis.zip ``` 1. Enter the workflow project directory ```bash cd nasdaq_analysis ``` ## Review Workflow As a reminder, here is the workflow from the introductory tutorial that you will be modifying. ```yaml timezone: UTC schedule: daily>: 07:00:00 _export: td: database: workflow_temp +task1: td>: queries/daily_open.sql create_table: daily_open +task2: td>: queries/monthly_open.sql create_table: monthly_open ``` ## Run the Workflow As Is Go to your Treasure Data jobs page, so you can follow along as you run the following workflows. You can access the page here: https://console.treasuredata.com/jobs Go into the `nasdaq_analysis` directory, and run the following command. ```bash td wf run --all ``` Include `--all` to make sure that you can run the workflow even if you ran it previously. TD Workflows automatically remembers that it has run successfully, and shouldn't need to be run again. You can overwrite this condition by including this condition. You should see the following job runs in your account. ![](/assets/workflow-presto-presto.e1ceb441d034b86aff2711ecd2bebbaeb97417c256a838bd561a5f6983dbe6a6.142841d8.png) ## Modify So the Dependent Task Executes a Hive Job Having a query run on Hive is as simple as adding an extra parameter. Modify your workflow file with the following addition of `engine: hive` as a parameter to +task2. ```yaml +task2: td>: queries/monthly_open.sql create_table: monthly_open engine: hive ``` ## Run the Query of the Modified Workflow ```bash td wf run --all ``` ![](/assets/workflow-presto-hive.0a0c9f437f11e08e77a07c0bcc1d7c791de7c7a87e5197d98abfc9c59449356c.142841d8.png) ## Additional Presto and Hive Resources Reference information can be found here: * [Treasure Data Hive Function Reference](https://api-docs.treasuredata.com/en/tools/hive/td_hive_function_reference/#treasure-data-hive-function-reference) * [Hivemall Function Reference](https://api-docs.treasuredata.com/en/tools/hive/hivemall_reference/#hivemall-function-reference) * [Treasure Data Presto API Reference](https://api-docs.treasuredata.com/en/tools/presto/api/#td-presto-api-reference) Additional [Hive documentation](https://api-docs.treasuredata.com/en/tools/hive/quickstart/#about-the-hive-engine) and [Presto documentation](https://api-docs.treasuredata.com/en/tools/hive/quickstart/#about-the-hive-engine) can be found on the [Treasure Data Developer Portal](https://api-docs.treasuredata.com/).