---
title: "How do I schedule a Luminesce SQL query?"
slug: "how-do-i-schedule-a-luminesce-sql-query"
updated: 2024-08-21T14:23:51Z
published: 2024-08-21T14:23:51Z
canonical: "support.lusid.com/how-do-i-schedule-a-luminesce-sql-query"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://support.lusid.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How do I schedule a Luminesce SQL query?

Providing you are a LUSID user with sufficient [access control permissions](/v1/docs/creating-policies-to-control-access-to-providers-for-different-luminesce-end-users), you can schedule a [Luminesce SQL query](/v1/docs/understanding-the-luminesce-sql-query-syntax) to run automatically at a set time or on a regular basis.

> **Note:** If you are the LUSID domain owner, you are automatically assigned the built-in `lusid-administrator` role, which has all the permissions necessary to use the providers in this article.

Once it has run, the results of the scheduled query are available in console format. However, it might be more useful to include an alternative output destination in the query itself, for example by using the [Drive.SaveAs](/v1/docs/drivesaveas) provider to write the results directly to a CSV file in Drive.

## Using the LUSID web app

1. Sign in to the [LUSID web app](https://www.lusid.com/app) using the credentials of a LUSID administrator.
2. From the top left menu, select **Data Virtualisation > Query Editor**.
3. Write a valid query (you might want to click the **Run** button to test the results are as you expect).
4. Click the **Schedule query** button: ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/7a6aa816-236a-499b-8072-4de2e2ce2a28.png)
5. On the **Specify job** page of the **Create Schedule** screen, specify a **Scope**, **Code**, **Schedule name** and **Description**: ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/96456251-723d-4c21-8805-cec468145019.png)
6. On the **Arguments** page, check the following mandatory arguments (boxes in red):

You can ignore all the other arguments. ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/e7caf7c7-348f-42fb-9213-0571e43e99f9.png)
  - `QUERY_01` contains your Luminesce SQL query.
  - `--authPersonalAccessToken` is set to `%FBN_PAT%`. If not, perform Step 1 again.
  - `--authFlow` is set to `None`.
  - `--timeout` is set to `3540` or lower.
7. On the **Triggers** page, click the **Add trigger** button to add at least one trigger for the schedule (note all times are in UTC): ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/e299896a-7ad7-45cc-9657-f53934058da5.png) Note you can choose the **Cron** option to explicitly specify a cron expression adhering to [this standard](https://www.quartz-scheduler.net/documentation/quartz-3.x/tutorial/crontrigger.html#introduction).

The scheduled query should now automatically run at the appointed time(s). You can see (and potentially pause) it by navigating to the **Jobs & Scheduling > Schedules** dashboard:

Once the scheduled query has run successfully, you can navigate to the **Jobs & Scheduling > History** dashboard and click on the appropriate **Run ID** URL to access the details:

![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/3fb7d7b4-cb8f-4390-97e2-48d7bc4593e3.png)

On the **Jobs & Scheduling > Details** dashboard, navigate to the **Console Output** tab to see the query results:

![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image(7).png)
