---
title: "Lusid.DataType"
slug: "lusiddatatype"
updated: 2024-11-25T17:00:36Z
published: 2024-11-25T17:00:36Z
canonical: "support.lusid.com/lusiddatatype"
---

> ## 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.

# Lusid.DataType

| **Type** | **Read/write** | **Author** | **Availability** |
| --- | --- | --- | --- |
| [Data provider](/v1/docs/what-are-a-data-provider-and-a-direct-provider) | Read | Finbourne | Provided with LUSID |

Providing you have sufficient [access control permissions](/v1/docs/creating-policies-to-control-access-to-providers-for-different-luminesce-end-users), the `Lusid.DataType` provider enables you to write a [Luminesce SQL query](/v1/docs/understanding-the-luminesce-sql-query-syntax) that retrieves [data types](/v1/docs/what-is-a-data-type) stored in LUSID.

**See also:** [Lusid.DataType.Writer](/v1/docs/lusiddatatypewriter)

## Basic usage

```sql
select * from Lusid.DataType where <filter-expression>
```

## Query parameters

`Lusid.DataType` has parameters that enable you to filter or refine a query.

To list available parameters, their data types, default values, and an explanation for each, run the following query using a suitable tool:

```sql
select FieldName, DataType, ParamDefaultValue, Description from Sys.Field where TableName = 'Lusid.DataType' and FieldType = 'Parameter';
```

## Data fields

By default, `Lusid.DataType` returns a table of data populated with particular fields (columns). You can return just a subset of these fields if you wish.

To list fields available to return, their data types, whether fields are considered 'main', and an explanation for each, run the following query using a suitable tool:

```sql
select FieldName, DataType, IsMain, IsPrimaryKey, SampleValues, Description from Sys.Field where TableName = 'Lusid.DataType' and FieldType = 'Column';
```

> [!NOTE]
> Note
> 
> Fields marked 'main' are returned by queries that select a caret character, for example `select ^ from Lusid.DataType`.

## Examples

> [!NOTE]
> Note
> 
> For more example Luminesce SQL queries, visit our [Github repo](https://github.com/finbourne/luminesce-examples/tree/master/examples).

### Example 1: Retrieve the first ten data types

```sql
select * from Lusid.DataType limit 10;
```

### Example 2: Retrieve the accepted values for a particular data type

```sql
select AcceptableValues from Lusid.DataType where Scope = 'system' and Code = 'rating';
```

The table of data returned by the query looks like this:

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

### Example 3: Retrieve data type information when creating a property definition

In this example, `Lusid.DataType` is used to retrieve the `DataTypeScope` for the `string` data type. This is then passed into [Lusid.Property.Definition.Writer](/v1/docs/lusidpropertydefinitionwriter) to upsert a new property type.

```sql
@table_of_data = select Scope as DataTypeScope, 
  'Instrument' as Domain, 'Finbourne-Examples' as PropertyScope, 'string' as DataTypeCode, 
  'property' as ConstraintStyle, 'SICCode' as PropertyCode, 'SIC Code' as DisplayName, 'upsert' as WriteAction
  from Lusid.DataType where Code = 'string';

select * from Lusid.Property.Definition.Writer where ToWrite = @table_of_data;
```
