Tools.Describe

Type

Read/write

Author

Availability

Data provider

Read

Finbourne

Provided with LUSID

The Tools.Describe provider enables you to write a Luminesce query that provides the column names and corresponding data types for a given table of data.

Note: The LUSID user running the query must have sufficient access control permissions to use this provider. This should automatically be the case if you are the domain owner.

You can use this provider in conjunction with other providers to retrieve a description of their column names and data types, see examples 2 and 3.

Basic usage

@data = select * from <table-name>;
select * from Tools.Describe where ToDescribe = @data;

Query parameters

Tools.Describe has parameters that enable you to filter or refine a query.

Note: The ToDescribe parameter is mandatory.

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 = 'Tools.Describe' and FieldType = 'Parameter';

Data fields

By default, Tools.Describe 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:

Note: Fields marked 'primary key' are returned by queries that start select ^ from Tools.Describe...

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

Examples

Example 1: Return column names and data types for a table of data

@data = select 'x' as SomeText, 12 as SomeNumber, #2023-03-12# as SomeDate;

select * from Tools.Describe where ToDescribe = @data

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

Example 2: Return column names and data types for a provider

@data = select * from Lusid.Portfolio.Holding limit 1;

select * from Tools.Describe where ToDescribe = @data

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

Note this example is intended to show how the Tools.Describe provider works. The Sys.Field provider can alternatively be used to achieve the same result more efficiently.

Example 3: Return column names and data types from a CSV file in Drive

In this example, the Drive.Csv provider is used to extract and create a table of data from a CSV file in Drive. Tools.Describe is then used to retrieve any column names and their corresponding data types from the table of data.

@x = use Drive.Csv
--file=/trade-files/eod.csv
enduse;

select * from Tools.Describe where ToDescribe = @x;