Relations define intra-source connections and enable users to configure lookups and cross-source aggregates.
Creating Relations
Self Relations: The user can define a relation between the current source and itself by selecting the current source in the related source modal. Self relations can never be primary.
Relation Properties
- Relation Name: The name of the Relation must be globally unique.
- Relation Description: Optional description for the relation between sources.
- [This] Source: Visual indicator of the source you are currently selected on/creating the relation for.
- Related Source: Specify the source for which a relationship with the current source is being defined.
- Cardinality: Shown for both [This] Source and [Related] Source. Indicates whether the data is unique on each side of the relation. If unique, the cardinality is 1. Otherwise, cardinality is Many.
- Relation Expression: This is a boolean expression written in SQL that "joins" the current Source (denoted by "[This]") to the related Source (denoted by "[Related]"). The Relation will return 0, 1, or many records depending on the result of the expression.
- Primary Flag: Useful when there is only one valid relation between two sources, or a set of traversals between sources.
- Active Flag: Indicates if the Relation is currently available to Rule expressions and can be accessed during data processing.
Across the DataForge platform, a grey (un-clickable) "Save" button indicates there is an error with the parameters. Typically this error is within an expression field. Double check errors and expressions if you are unable to "Save" your work.
Graph View vs Table View
Graph View
Table View
Primary Relations
Relation Expressions
Example Relation Expressions
[This].ProductID = [Related].ProductID
[This].Subtotal BETWEEN ([Related].Subtotal - 10) AND ([Related].Subtotal + 10)
[This].Subtotal <= [Related].Subtotal
Creating 1:1 or 1:Many Relation Cardinality
When Key Data Refresh Type is used for a source, the Key Column that is identified from the raw schema will be flagged as a unique field. Any relations built with this field will result in 1:1 or 1:Many cardinality.
For sources with other Data Refresh Types like Full, the fields brought in from the raw schema are not automatically identified as unique. By default, any relation using a non-unique field in the relation expression will result in Many:1 or Many:Many relations.
To create a 1:1 or 1:Many relation using one of these non-unique fields, a new Rule needs to be created that references the raw attribute directly and the Unique Value toggle should be turned on for the rule.
Example Unique Rule created from raw attribute
When this unique rule is used in the Relation Expression, the cardinality will result in 1:1 or 1:Many.
Sub-Source Relations
Each sub-source has an implicit relation with M:1 cardinality to its parent source. Additional relations can be added to the sub-source similar to working with relations in a regular source.
For full documentation, visit Sub-Sources.
Updated