Views:
TypeRead/writeAuthorAvailability
Data providerReadFinbourneProvided with LUSID

The Lusid.LegalEntity provider enables you to write a Luminesce SQL query that retrieves legal entities defined in LUSID, such as international banks, investment firms, pension companies and so on.

Note: The LUSID user running the query must have sufficient access control permissions to both use the provider and read legal entity data stored in LUSID. This should automatically be the case if you are the domain owner.

See also: Luisd.LegalEntity.Writer

Prerequisites

Note: You only need perform the operation in this section once, for both Lusid.LegalEntity and Luisd.LegalEntity.Writer.

A legal entity must have at least one user-specified identifier from which LUSID can generate a unique internal LUID. Consider the following JSON representation of a legal entity in LUSID:

"displayName": "Acme Bank Inc",
"description": "An international bank",
"lusidLegalEntityId": "LUID_00003D6Y",
"identifiers": {
  "LegalEntity/InternationalBanks/BankId": {
     "key": "LegalEntity/InternationalBanks/BankId",
     "value": {
       "labelValue": "AcmeInc"
     },
     "effectiveFrom": "0001-01-01T00:00:00.0000000+00:00"
   }
}

It's important to note that Lusid.LegalEntity does not know anything about the LegalEntity/InternationalBanks/BankId identifier out-of-the-box. For this reason, a field representing this identifier cannot be listed in the Luminesce catalog by default. In order to retrieve legal entities, you must first run a special SQL query to 'inline' the identifier as a field in Lusid.LegalEntity, so that it appears in the catalog and can be interacted with:

@identifiersToCatalog = values
('LegalEntity/InternationBanks/BankId', 'IntBankId', True, 'An identifier for this legal entity as an international bank');

@config = select column1 as [Key], column2 as Name, column3 as IsMain, column4 as Description from @identifiersToCatalog;

select * from Sys.Admin.Lusid.Provider.Configure
where Provider = 'Lusid.LegalEntity'
and Configuration = @config;

You can now use Lusid.LegalEntity in the normal way to retrieve legal entity fields, including the newly-added identifier field (which is listed in the catalog as IntBankID).

Basic usage

select * from Lusid.LegalEntity where <filter-expression>

Query parameters

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

Data fields

By default, Lusid.LegalEntity returns a table of data populated with particular fields (columns). You can return a subset of these fields.

Note: The LEI field returns the value of the LegalEntity/default/LEI system property, if populated.

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.LegalEntity' and FieldType = 'Column';

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

Examples

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

Example 1: Retrieve the first 20 legal entities

select * from Lusid.LegalEntity Limit 20;

Example 2: Retrieve legal entities with particular names and descriptions

select * from Lusid.LegalEntity where DisplayName like '%Asset%' and Description like '%City%';