First-Last
First-Last features are great for enrichments of fields from one-to-many relations. It is commonly used to enrich an entity with fields of the first or last appearance of a one-to-many related assets or entities.
Simple first-last feature
In this example, we define simple first-last
features for the entity customer
:
type
type
The feature type.
In case of first-last features, it should be set to first_last
.
name
name
Give the feature a name.
asset
asset
The data asset with the field to be added as feature to our entity.
asset
should be the full path: "db.schema.name".
join_name
[optional]
join_name
[optional]In case multiple join patterns are defined between an entity and a data asset, join_name
is used to determine which join path to use for a specific feature.
data_type
[optional]
data_type
[optional]Specify the feature data type.
If no data_type specified, Lynk will assume the data type is string
.
The options for data types are:
string
For any type of string data type
number
For any type of number data type. For example: integer, float, decimal etc..
datetime
For any type of time-based data type. For example: date, timestamp, datetime etc..
bool
For boolean data type.
time_field
[optional]
time_field
[optional]options
options
The options for the first-last definitions on which field we would like to get and how to sort the related data asset
method
method
Determines which instance of the data asset to retrieve - the first
or the last
, based on the sort_by
option.
sort_by
sort_by
The data asset field to sort by.
field
field
The name of the data asset field to retrieve as the entity feature.
filters
filters
Last updated