---
title: "How do I query a dataset?"
slug: "how-do-i-query-a-custom-dataset"
updated: 2026-06-07T07:12:47Z
published: 2026-06-07T07:12:47Z
canonical: "support.lusid.com/how-do-i-query-a-custom-dataset"
stale: true
---

> ## 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 query a dataset?

You can query a dataset for [records that have been added](/v1/docs/how-do-i-add-records-to-a-custom-dataset) at any time.

## Methods

LUSID web appLUSID APILuminesce

Call the [QueryRelationalData](https://www.lusid.com/docs/api/lusid/endpoints/relational-datasets/QueryRelationalData/) API, specifying the scope and code of the RDD in the URL, and optionally a request body containing parameters. For example:

```json
curl -X POST 'https://<your-domain>.lusid.com/api/api/relationaldatasets/MyDatasets/Addresses/$query'
  -H 'Content-Type: application/json-patch+json'
  -H 'Authorization: Bearer <your-API-access-token>'
  -d '{
  "queryMethod": "Latest",
  "filter": "effectiveAt gt 2026-01-01",
  "customSortBy": [
    {
      "fieldName": "dataSeries.applicableEntity.entityType",
      "remainderOrder": "DESC"
    },
    {
      "fieldName": "dataSeries.seriesIdentifiers[AddressType]",
      "remainderOrder": "ASC"
    }
  ]
}'
```

Navigate to the **Data Management > Relational Datasets** dashboard and click the **Display name** of the dataset you want to query, for example:

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

Every record in the dataset is returned when **Query Method** is set to **Time Series**. Switch to **Latest** to return just [data series](/v1/docs/anatomy-of-a-dataset), or you can filter fields in the standard way to reduce the number of records:

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

Write a Luminesce SQL query using the [Lusid.RelationalDataset.<rdd-scope>.<rdd-code>](/v1/docs/lusidrelationaldatasetxx) provider and execute it using a tool such as the LUSID web app, for example:

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

## API request fields

This section supplements the [API documentation](https://www.lusid.com/docs/api/lusid/endpoints/relational-datasets/BatchUpsertRelationalData).

If omitted, `queryMethod` defaults to `TimeSeries` and every record is returned (including data points within data series). To return just data series, set `queryMethod` to `Latest`. [More information](/v1/docs/anatomy-of-a-dataset).

You can optionally specify a `filter` to restrict the data returned. See the section below.

You can optionally specify a `customSortBy` object to sort returned data by up to two categories. In the LUSID API example above, records are sorted first by entity type and then by a particular series identifier. Allowed values for `fieldName` are the same as those for filtering in the table below. The `remainderOrder` must either be `ASC` or `DESC`.

## API filtering syntax

You can use LUSID’s standard [filter syntax](/v1/docs/filtering-information-retrieved-from-lusid) to reduce the number of records returned by a query:

| To filter on… | Syntax | Example(s) |
| --- | --- | --- |
| Primary key fields | - `dataSeries.seriesScope &lt;operator&gt; &lt;value&gt;` - `dataSeries.applicableEntity.entityType &lt;operator&gt; &lt;value&gt;` - `dataSeries.applicableEntity.entityScope &lt;operator&gt; &lt;value&gt;` - `dataSeries.applicableEntity.identifierScope &lt;operator&gt; &lt;value&gt;` - `dataSeries.applicableEntity.identifierType &lt;operator&gt; &lt;value&gt;` - `dataSeries.applicableEntity.identifierValue &lt;operator&gt; &lt;value&gt;` - `dataSeries.applicableEntity.subentityid &lt;operator&gt; &lt;value&gt;` | - `dataSeries.seriesScope in ('Growth','Income')` - `dataSeries.applicableEntity.identifierType eq 'Isin'` - `dataSeries.applicableEntity.identifierValue exists` |
| Effective date | `effectiveAt &lt;operator&gt; &lt;value&gt;` | `effectiveAt gt 2026-01-01` |
| Series identifier fields | `dataSeries.seriesIdentifiers[&lt;fieldName&gt;] &lt;operator&gt; &lt;value&gt;` | `dataSeries.seriesIdentifiers[AddressType] neq 'Registered'` |
| Value fields | `valueFields[&lt;fieldName&gt;] &lt;operator&gt; &lt;value&gt;` | `valueFields[Street] eq '123 Main Street'` |
| Metadata fields | `metaDataFields[&lt;fieldName&gt;] &lt;operator&gt; &lt;value&gt;` | `metaDataFields[Email] startswith 'john@'` |
