Getting started with the Luminesce Query Editor

Prev Next

In about fifteen minutes, you'll find a provider, write and run a query, explore and format the results, then save the query and export the results to Excel, all in your browser. Along the way you'll meet the parts of the Luminesce Query Editor you'll use every day. The examples query Luminesce's own catalogue, so they work in any LUSID domain.

Prerequisites

  • Access to the Luminesce Query Editor in the LUSID web app, under Data Virtualisation > Query Editor.

  • Permission to query the Sys.Field provider, which lists the fields of every provider in your catalogue.

Step 1: Open the Query Editor

  1. Sign in to the LUSID web app and select Data Virtualisation > Query Editor.

  2. Select + above the editor, then New Tab. Each tab holds a query of its own, with its own results, so you can keep this one separate from anything else you're working on.

The editor, where you write SQL, is in the middle. The Catalogue, which lists what you can query, is on the right, and the results appear under the editor. For a full tour of the screen, see Understanding the Query Editor workspace.

Step 2: Look up a provider

Before you write a query, it helps to know what you can query.

  1. In the Catalogue, type Sys.Field in Search.

  2. Open the Sys folder and select Sys.Field to see its fields.

  3. Hover over TableName and FieldType to read their descriptions. TableName is the name of a provider, and FieldType says whether a field is a column or a parameter.

Every provider you can use is in the Catalogue, with its fields and documentation. See How do I find providers and fields in the catalogue?

Step 3: Write and run a query

This query counts the columns of each Lusid.Instrument provider in your catalogue:

select TableName, count(*) as Columns
from Sys.Field
where TableName like 'Lusid.Instrument%' and FieldType = 'Column'
group by TableName
order by Columns desc
  1. Type it into the editor rather than pasting it, to see autocomplete at work. As you type from Sys.F, the editor offers the matching providers. Press Enter or Tab to accept one, or Ctrl+Space to bring the list back (or to get it in the first place if auto-complete option is turned off). It does the same for fields, functions and keywords.

  2. Select Run, or press Shift+Enter.

The status beside the toolbar shows In progress while the query runs, then Succeeded, and the results appear under the editor. If you've mistyped something, the editor underlines it; fix it and run the query again.

Step 4: Explore the results

The grid holds every row of the result, however many there are.

  • Select the Columns heading to sort by it. Select it again to sort the other way.

  • Select the filter icon beside the box under the Columns heading, choose Greater than and type 20. Only the larger providers are left, and the row count beside Results changes to match. Select Filters on the toolbar, then Clear all, to show every row again.

  • Drag across a few cells in the Columns column. The bar under the grid shows their sum, average, count, minimum and maximum.

See How do I filter, group and total results?

Step 5: Make the results easy to read

First, colour the largest providers so they stand out:

  1. Hover over the Columns heading, select its menu icon, then Conditional formatting.

  2. Select Add rule. Leave Based on as Columns, choose is greater than and type 160.

  3. For Apply to, choose Cell fill, then Green.

  4. Select Apply.

Then add a total under the grid:

  1. Open the Columns side bar on the right of the grid.

  2. Drag Columns into Aggregations (groups / footer).

  3. On its pill, select the function and choose Sum.

The footer now shows the total number of columns across every provider in the result.

See How do I format results?

Step 6: Change the query and run it again

  1. In the editor, change 'Lusid.Instrument%' to 'Lusid.Portfolio%'.

  2. Press Shift+Enter.

The results now count the columns of the portfolio providers. Your colour rule and footer total stay with the tab, so they apply to the new results too.

To run just part of a longer query, highlight it before you press Shift+Enter. See How do I run a query and follow its progress?

Step 7: Save the query

  1. Select Save.

  2. In the Save query dialog, choose My Workspace, type tutorials as the Group and Columns per provider as the Item Name.

  3. Leave Save formattings ticked, so the colour rule and total are saved with the query.

  4. Select Save.

The tab now has the query's name. Next time, select +, then Saved Queries, to open it, and its results look just as you left them. To share a query with your team, save it to a shared workspace instead. See How do I save, open and share queries?

Step 8: Export the results to Excel

  1. Select the export button (a cloud with a downward arrow) in the toolbar above the grid.

  2. Under File type, choose Excel.

  3. Leave everything under Include ticked, so the workbook keeps the sorting, the green cells and the total.

  4. Check the File name, which starts as the query's name, and select Export.

Your browser downloads the workbook. Open it, and it looks just like the grid. You can also save the file to Drive from the same panel. See How do I copy and download results?

Step 9: Ask Candela about the query

Candela is FINBOURNE's AI agent.

  1. Select the Candela button on the toolbar to open the Query Editor Assistant.

  2. Turn on add query beside the prompt, so Candela can see the query in your tab.

  3. Type What does this query tell me? and send it.

Candela explains the query. Try asking it for another one, for example Which Lusid providers have the most parameters?, and select Add to query editor to put its answer in the editor, ready to run. See How do I use Candela in the Query Editor?

Note: Candela is currently available to some customers only. Everything else in this tutorial works without it.

What's next