
## Schedule a query

URL: https://docs.atlan.com/product/capabilities/insights/how-tos/schedule-a-query

> Schedule saved queries to run repeatedly on a schedule. Configure hourly, daily, weekly, or monthly runs with custom cron expressions, and automatically share results with users via email.

:::warning Who can do this?
 Before scheduling a query, you will need your Atlan administrator to [enable scheduled queries](https://docs.atlan.com/llms/governance/administration/enable-scheduled-queries/llms.txt).

:::

You might want to schedule a query to run repeatedly. For example:

- If you want to fetch data for the same query at different times.
- If you want to share data with business teams on a consistent basis, for example, weekly.
- If a data analyst is out of office but wants the data to be shared with users periodically.

:::warning

You must [save your query](https://docs.atlan.com/llms/catalog/insights/save-and-share-queries/llms.txt) before you can schedule it. Your [SMTP configuration](https://docs.atlan.com/llms/governance/integrations/configure-smtp/llms.txt) must also be in a working state to send results to recipients.

:::

## Schedule a query

To schedule a query:

1. From the left sidebar, click on **all assets** and then click on Data Exploration to open Data Exploration.
 * If you are using the **Old UI (Classic)**, from the left menu of any screen, click **Data Exploration**.

2. In the upper left, click the **papers-in-a-box** icon to open your query collections.
3. Choose the query collection where the query you want to schedule is saved.
4. Hover over the saved query you want to schedule, click the **three dots** to its right, and then click **Schedule**.
5. In the _New Schedule Query_ dialog, enter the scheduling details: 
 1. For _Name_, enter a meaningful name for the scheduled query.
 2. For _Runs every_, choose how often the query should run: 
 - For _Hour_ and _Day_, you can go down to the minute for hourly and daily runs.
 - For _Week_, you can select multiple days for a weekly run.
 - For _Month_, you can select multiple dates for a monthly run.
 - For _Custom cron_, write your own custom cron.
 3. For _Timezone_, select a relevant option or keep the default one.
 4. For _Share Results_, select the user(s) to whom you want to send the results from each run.
 5. (Optional) If there are any existing schedules for your query, from the top right, click the existing schedule link to view more details in a sidebar.
 6. At the bottom right of the dialog, click **Done**.
6. (Optional) Under _Query successfully scheduled_, click the **Run Now** link if you want to test the scheduled query.
7. At the bottom right of the dialog, click **Finish**.

Your query will now run on the defined schedule and the results will be sent out automatically! 🎉

Note that the download link for the results is only valid for **6** hours. 

:::info **Did you know?** 
 If a scheduled query fails, you'll receive an email notification with the name of the query, so you can troubleshoot and get it running in no time.

:::

## Change a scheduled query

To change the schedule for a query:

1. From the left sidebar, click on **all assets** and then click on Data Exploration to open Data Exploration.
 * If you are using the **Old UI (Classic)**, from the left menu of any screen, click **Data Exploration**.

2. In the upper left, click the repeating-arrow icon to open your scheduled queries.
3. Hover over the scheduled query you want to change, click the **three dots** to its right, and then:
 1. (Optional) Click **Run now** to run the scheduled query immediately.
 2. (Optional) Click **Pause** to pause the scheduled query.
 3. Click **Edit** to update the scheduled query.
4. In the _Update Schedule Query_ dialog box, make any desired changes to the schedule or recipients.
5. At the bottom right of the dialog box, click **Update** to save the changes.
6. (Optional) Under _Query successfully updated_, click the **Run Now** link if you want to test the scheduled query.
7. At the bottom right of the dialog, click **Finish**.

Your query will now run on the changed schedule and the results will be sent out automatically! 🎉

## Remove a scheduled query

To remove a scheduled query:

1. From the left sidebar, click on **all assets** and then click on Data Exploration to open Data Exploration.
 * If you are using the **Old UI (Classic)**, from the left menu of any screen, click **Data Exploration**.

2. In the upper left, click the repeating-arrow icon to open your scheduled queries.
3. Hover over the scheduled query you want to stop, click the **three dots** to its right, and then click **Delete**.
4. In the _Delete Schedule_ dialog box, click **Delete**.

Your query will no longer run automatically.

---
