Type | Read/write | Author | Availability |
Read | Finbourne | Provided with LUSID |
Providing you have sufficient access control permissions, the Lusid.DataType
provider enables you to write a Luminesce SQL query that retrieves data types stored in LUSID.
See also: Lusid.DataType.Writer
Basic usage
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:
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:
select FieldName, DataType, IsMain, IsPrimaryKey, SampleValues, Description from Sys.Field where TableName = 'Lusid.DataType' and FieldType = 'Column';
Note
Fields marked 'main' are returned by queries that select a caret character, for example
select ^ from Lusid.DataType
.
Examples
Note
For more example Luminesce SQL queries, visit our Github repo.
Example 1: Retrieve the first ten data types
select * from Lusid.DataType limit 10;
Example 2: Retrieve the accepted values for a particular data type
select AcceptableValues from Lusid.DataType where Scope = 'system' and Code = 'rating';
The table of data returned by the query looks like this:
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 to upsert a new property type.
@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;