Lusid.Property.Definition

Type

Read/write

Author

Availability

Data provider

Read

Finbourne

Provided with LUSID

The Lusid.Property.Definition provider enables you to write a Luminesce SQL query that retrieves property types stored in LUSID.

These include all the property types and derived property types you create yourself, and a selection of property types underlying system properties and valuation metrics provided with LUSID.

See also: Lusid.Property.Definition.Writer

select * from Lusid.Property.Definition where <filter-expression>;
SQL

Lusid.Property.Definition 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.Property.Definition' and FieldType = 'Parameter';
SQL

By default, Lusid.Property.Definition 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.Property.Definition' and FieldType = 'Column';
SQL

Note: Fields marked 'main' are returned by queries that use a caret character, for example select ^ from Lusid.Property.Definition.

Note: For more example Luminesce SQL queries, visit our Github repo.

select * from Lusid.Property.Definition;
SQL

You can exclude property types for system properties, valuation metrics and potentially other settings provided with LUSID by filtering out the protected system and default scopes.

select * from Lusid.Property.Definition where PropertyScope not in ('system', 'default');
SQL

You can retrieve just derived property types by filtering out the protected system and default scopes and setting isDerived to True.

select * from Lusid.Property.Definition where PropertyScope not in ('system', 'default') and isDerived = True;
SQL

A derived property type has a derivation formula that may reference other property types. The following query retrieves dependent property types for all derived property types in a particular domain, in this case Instrument:

select DISTINCT
  substr(sRow.Value, 1, instr(sRow.Value, ']') - 1) as propertyKey
  ,def.PropertyKey as DerivedPropertyKey
from
  Lusid.Property.Definition def
left outer join
  Tools.Split sRow on def.DerivationFormula = sRow.Original and sRow.DelimiterString = 'Properties['
left outer join
  Lusid.Property.Definition prop on prop.propertyKey = substr(sRow.Value, 1, instr(sRow.Value, ']') - 1)
where
  def.domain = 'Instrument' and
  def.IsDerived = true and
  def.PropertyScope not in ('LUSID-Onboarding','default','system') and
  def.[ConstraintStyle] not in ('Identifier') and
  instr(sRow.Value, ']') > 0 
SQL

The query generates one row per dependency per derived property type. So for example if an Instrument/Derived/Domicile derived property type has the following derivation formula:

map(coalesce(Properties[Instrument/SourceA/country_issue], Properties[Instrument/SourceB/origin], 'Unknown'): 'United Kingdom'='UK', 'united kingdom'='UK', 'United States'='USA', 'US'='USA', default='Unknown')

…then the query produces the following two rows for Instrument/Derived/Domicile:

You can retrieve property types for a particular set of property scopes, such as those used by your data vendors.

select * from Lusid.Property.Definition where PropertyScope in ('VendorA', 'VendorB', 'VendorC');
SQL

You can join Lusid.Property.Definition to a property provider such as Lusid.Portfolio.Txn.Property to decorate transaction properties with associated property type details, such as Lifetime:

select
    tp.TxnId,
    tp.PortfolioScope,
    tp.Value,
    pd.PropertyScope,
    pd.PropertyCode,
    pd.DisplayName,
    pd.Description,
    pd.DataType,
    pd.PropertyKey,
    pd.Lifetime
from Lusid.Property.Definition pd
inner join Lusid.Portfolio.Txn.Property tp
    on tp.PropertyScope = pd.PropertyScope and tp.PropertyCode = pd.PropertyCode 
where tp.PortfolioScope = 'Finbourne-Examples' and pd.PropertyScope not in ('system', 'default');
SQL