From aac859539fdb592d58e617579cd443823a2963d8 Mon Sep 17 00:00:00 2001
From: ialdg <39755524+ialdg@users.noreply.github.com>
Date: Wed, 3 Apr 2024 14:23:26 +0200
Subject: [PATCH 01/16] Update entities.md
Hi.
This modification proposal adds a comment to the Unique bulletpoint suggesting the addition of examples to differentiate between Primary and Unique.
Regards.
IL.
---
website/docs/docs/build/entities.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/website/docs/docs/build/entities.md b/website/docs/docs/build/entities.md
index e44f9e79af6..12e9b8c4665 100644
--- a/website/docs/docs/build/entities.md
+++ b/website/docs/docs/build/entities.md
@@ -24,6 +24,8 @@ You can also use entities as a dimensions, which allows you to aggregate a metri
MetricFlow's join logic depends on the entity `type` you use, and it also determines how to join semantic models. Refer to [Joins](/docs/build/join-logic) for more info on how to construct joins.
* **Primary —** A primary key has **only one** record for each row in the table, and it includes every record in the data platform.
+
+[comment]: It'd be a good idea to provide some examples to differentiate between Primary and Unique because, for instance, what does it mean that Unique may have a subset of records? Regards.
* **Unique —** A unique key contains **only one** record per row in the table, but it may have a subset of records in the data warehouse. It can also include nulls.
* **Foreign —** A foreign key can include zero, one, or multiple instances of the same record. Null values may also be present.
* **Natural —** Natural keys are column or combination of columns in a table that uniquely identify a record based on real-world data. For instance, in a sales_person_department dimension table, the sales_person_id can serve as a natural key.
From ac9cde9190566b7594d71f514f777a45a0c5d02e Mon Sep 17 00:00:00 2001
From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com>
Date: Thu, 25 Jul 2024 13:19:31 +0100
Subject: [PATCH 02/16] Update entities.md
---
website/docs/docs/build/entities.md | 84 +++++++++++++++++++++++++----
1 file changed, 74 insertions(+), 10 deletions(-)
diff --git a/website/docs/docs/build/entities.md b/website/docs/docs/build/entities.md
index 12e9b8c4665..3b510203507 100644
--- a/website/docs/docs/build/entities.md
+++ b/website/docs/docs/build/entities.md
@@ -15,22 +15,84 @@ Entities can be specified with a single column or multiple columns. Entities (jo
There are four entity types: primary, foreign, unique, or natural.
:::tip Use entities as a dimensions
-You can also use entities as a dimensions, which allows you to aggregate a metric to the granularity of that entity.
+You can also use entities as a dimension, which allows you to aggregate a metric to the granularity of that entity.
:::
## Entity types
-MetricFlow's join logic depends on the entity `type` you use, and it also determines how to join semantic models. Refer to [Joins](/docs/build/join-logic) for more info on how to construct joins.
+MetricFlow's join logic depends on the entity `type` you use and determines how to join semantic models. Refer to [Joins](/docs/build/join-logic) for more info on how to construct joins.
-* **Primary —** A primary key has **only one** record for each row in the table, and it includes every record in the data platform.
+#### Primary
+A primary key has _only one_ record for each row in the table and includes every record in the data platform. It must contain unique values and can't contain null values. Use the primary key to ensure that each record in the table is distinct and identifiable.
-[comment]: It'd be a good idea to provide some examples to differentiate between Primary and Unique because, for instance, what does it mean that Unique may have a subset of records? Regards.
-* **Unique —** A unique key contains **only one** record per row in the table, but it may have a subset of records in the data warehouse. It can also include nulls.
-* **Foreign —** A foreign key can include zero, one, or multiple instances of the same record. Null values may also be present.
-* **Natural —** Natural keys are column or combination of columns in a table that uniquely identify a record based on real-world data. For instance, in a sales_person_department dimension table, the sales_person_id can serve as a natural key.
+For example, consider a table of employees with the following columns:
-The complete spec for entities is below:
+```sql
+employee_id (primary key)
+first_name
+last_name
+```
+In this case, `employee_id` is the primary key. Each `employee_id` is unique and represents one specific employee. There can be no duplicate `employee_id` and can't be null.
+
+#### Unique
+A unique key contains _only one_ record per row in the table but may have a subset of records in the data warehouse. However, unlike the primary key, a unique key allows for null values. The unique key ensures that the column's values are distinct, except for null values.
+
+For example, consider a table of students with the following columns:
+
+```sql
+student_id (primary key)
+email (unique key)
+first_name
+last_name
+```
+
+In this example, `email` is defined as a unique key. Each email address must be unique; however, multiple students can have null email addresses. This is because the unique key constraint allows for one or more null values, but non-null values must be unique. This then creates a set of records with unique emails (non-null) that could be a subset of the entire table, which includes all students.
+
+#### Foreign
+A foreign key is a field (or a set of fields) in one table that uniquely identifies a row in another table. The foreign key establishes a link between the data in two tables.
+It can include zero, one, or multiple instances of the same record. It can also contain null values.
+
+For example, consider you have two tables, `customers` and `orders`:
+
+customers table:
+
+```sql
+customer_id (primary key)
+customer_name
+```
+
+orders table:
+
+```sql
+order_id (primary key)
+order_date
+customer_id (foreign key)
+```
+
+In this example, the `customer_id` in the `orders` table is a foreign key that references the `customer_id` in the `customers` table. This link means each order is associated with a specific customer. However, not every order must have a customer; the `customer_id` in the orders table can be null or have the same `customer_id` for multiple orders.
+
+#### Natural
+
+Natural keys are columns or combinations of columns in a table that uniquely identify a record based on real-world data. For instance, in a `sales_person_department` dimension table, the `sales_person_id` can serve as a natural key. You can only use natural keys for [SCD type II dimensions](/docs/build/dimensions#scd-type-ii).
+
+For example, consider a table of `products` in an inventory system:
+
+```sql
+product_code (natural key)
+product_name
+manufacturer
+category
+```
+
+In this example, `product_code` serves as a natural key because it uniquely identifies each product in a real-world context, such as the stock-keeping unit (SKU) used by the company. It's based on the product's properties and has real-world meaning beyond the database system.
+
+### Entities configuration
+
+The complete spec for entities is as follows:
+
+
+
```yaml
entities:
- name: transaction ## Required
@@ -38,11 +100,13 @@ entities:
description: a description of the field or role the entity takes in this table ## Optional
expr: the field that denotes that entity (transaction_id). ## Optional
If not specified will default to name
-
```
+
+
Here's an example of how to define entities in a semantic model:
+
``` yaml
entities:
- name: transaction
@@ -55,4 +119,4 @@ entities:
type: foreign
expr: substring(id_order from 2)
```
-
+
From de8ee9e9ba01bab52c1dab83b9846a812da37ce9 Mon Sep 17 00:00:00 2001
From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com>
Date: Thu, 25 Jul 2024 13:36:57 +0100
Subject: [PATCH 03/16] Update entities.md
---
website/docs/docs/build/entities.md | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/website/docs/docs/build/entities.md b/website/docs/docs/build/entities.md
index a15945051ec..6f55edf2d7d 100644
--- a/website/docs/docs/build/entities.md
+++ b/website/docs/docs/build/entities.md
@@ -22,7 +22,7 @@ You can also use entities as dimensions, which allows you to aggregate a metric
MetricFlow's join logic depends on the entity `type` you use and determines how to join semantic models. Refer to [Joins](/docs/build/join-logic) for more info on how to construct joins.
-#### Primary
+### Primary
A primary key has _only one_ record for each row in the table and includes every record in the data platform. It must contain unique values and can't contain null values. Use the primary key to ensure that each record in the table is distinct and identifiable.
For example, consider a table of employees with the following columns:
@@ -34,7 +34,7 @@ last_name
```
In this case, `employee_id` is the primary key. Each `employee_id` is unique and represents one specific employee. There can be no duplicate `employee_id` and can't be null.
-#### Unique
+### Unique
A unique key contains _only one_ record per row in the table but may have a subset of records in the data warehouse. However, unlike the primary key, a unique key allows for null values. The unique key ensures that the column's values are distinct, except for null values.
For example, consider a table of students with the following columns:
@@ -48,7 +48,7 @@ last_name
In this example, `email` is defined as a unique key. Each email address must be unique; however, multiple students can have null email addresses. This is because the unique key constraint allows for one or more null values, but non-null values must be unique. This then creates a set of records with unique emails (non-null) that could be a subset of the entire table, which includes all students.
-#### Foreign
+### Foreign
A foreign key is a field (or a set of fields) in one table that uniquely identifies a row in another table. The foreign key establishes a link between the data in two tables.
It can include zero, one, or multiple instances of the same record. It can also contain null values.
@@ -71,7 +71,7 @@ customer_id (foreign key)
In this example, the `customer_id` in the `orders` table is a foreign key that references the `customer_id` in the `customers` table. This link means each order is associated with a specific customer. However, not every order must have a customer; the `customer_id` in the orders table can be null or have the same `customer_id` for multiple orders.
-#### Natural
+### Natural
Natural keys are columns or combinations of columns in a table that uniquely identify a record based on real-world data. For instance, in a `sales_person_department` dimension table, the `sales_person_id` can serve as a natural key. You can only use natural keys for [SCD type II dimensions](/docs/build/dimensions#scd-type-ii).
@@ -86,7 +86,7 @@ category
In this example, `product_code` serves as a natural key because it uniquely identifies each product in a real-world context, such as the stock-keeping unit (SKU) used by the company. It's based on the product's properties and has real-world meaning beyond the database system.
-### Entities configuration
+## Entities configuration
The following is the complete spec for entities:
@@ -100,14 +100,13 @@ entities:
expr: The field that denotes that entity (transaction_id). ## Optional
Defaults to name if unspecified.
```
-
Here's an example of how to define entities in a semantic model:
-``` yaml
+```yaml
entities:
- name: transaction
type: primary
@@ -119,16 +118,16 @@ entities:
type: foreign
expr: substring(id_order from 2)
```
-
-### Combine columns with a key
+## Combine columns with a key
If a table doesn't have any key (like a primary key), use _surrogate combination_ to form a key that will help you identify a record by combining two columns. This applies to any [entity type](/docs//build/entities#entity-types). For example, you can combine `date_key` and `brand_code` from the `raw_brand_target_weekly` table to form a _surrogate key_. The following example creates a surrogate key by joining `date_key` and `brand_code` using a pipe (`|`) as a separator.
+
```yaml
entities:
- name: brand_target_key # Entity name or identified.
From 9aa2a43f87aeec5ebb3cda97cecf11a8a98f51ae Mon Sep 17 00:00:00 2001
From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com>
Date: Thu, 25 Jul 2024 16:40:18 +0100
Subject: [PATCH 04/16] Update entities.md
---
website/docs/docs/build/entities.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/website/docs/docs/build/entities.md b/website/docs/docs/build/entities.md
index 6f55edf2d7d..1363981ab36 100644
--- a/website/docs/docs/build/entities.md
+++ b/website/docs/docs/build/entities.md
@@ -93,6 +93,7 @@ The following is the complete spec for entities:
```yaml
+
entities:
- name: transaction ## Required
type: Primary or natural or foreign or unique ## Required
@@ -107,6 +108,7 @@ Here's an example of how to define entities in a semantic model:
```yaml
+
entities:
- name: transaction
type: primary
@@ -129,11 +131,13 @@ If a table doesn't have any key (like a primary key), use _surrogate combination
```yaml
+
entities:
- name: brand_target_key # Entity name or identified.
type: foreign # This can be any entity type key.
expr: date_key || '|' || brand_code # Defines the expression for linking fields to form the surrogate key.
```
+
From 62bbf70c7d347197f8b69ab88079556851691339 Mon Sep 17 00:00:00 2001
From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com>
Date: Thu, 25 Jul 2024 16:45:00 +0100
Subject: [PATCH 05/16] Update entities.md
---
website/docs/docs/build/entities.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/website/docs/docs/build/entities.md b/website/docs/docs/build/entities.md
index 1363981ab36..62b04ea231c 100644
--- a/website/docs/docs/build/entities.md
+++ b/website/docs/docs/build/entities.md
@@ -90,7 +90,7 @@ In this example, `product_code` serves as a natural key because it uniquely iden
The following is the complete spec for entities:
-
+
```yaml
@@ -105,7 +105,7 @@ entities:
Here's an example of how to define entities in a semantic model:
-
+
```yaml
@@ -128,7 +128,7 @@ entities:
If a table doesn't have any key (like a primary key), use _surrogate combination_ to form a key that will help you identify a record by combining two columns. This applies to any [entity type](/docs//build/entities#entity-types). For example, you can combine `date_key` and `brand_code` from the `raw_brand_target_weekly` table to form a _surrogate key_. The following example creates a surrogate key by joining `date_key` and `brand_code` using a pipe (`|`) as a separator.
-
+
```yaml
From c4ed50ba1c0d0431bfd347325f061a1078c43657 Mon Sep 17 00:00:00 2001
From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com>
Date: Thu, 25 Jul 2024 16:57:52 +0100
Subject: [PATCH 06/16] Update entities.md
---
website/docs/docs/build/entities.md | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/website/docs/docs/build/entities.md b/website/docs/docs/build/entities.md
index 62b04ea231c..f7f20728b63 100644
--- a/website/docs/docs/build/entities.md
+++ b/website/docs/docs/build/entities.md
@@ -93,7 +93,6 @@ The following is the complete spec for entities:
```yaml
-
entities:
- name: transaction ## Required
type: Primary or natural or foreign or unique ## Required
@@ -101,6 +100,7 @@ entities:
expr: The field that denotes that entity (transaction_id). ## Optional
Defaults to name if unspecified.
```
+
Here's an example of how to define entities in a semantic model:
@@ -108,7 +108,6 @@ Here's an example of how to define entities in a semantic model:
```yaml
-
entities:
- name: transaction
type: primary
@@ -120,6 +119,7 @@ entities:
type: foreign
expr: substring(id_order from 2)
```
+
@@ -131,7 +131,6 @@ If a table doesn't have any key (like a primary key), use _surrogate combination
```yaml
-
entities:
- name: brand_target_key # Entity name or identified.
type: foreign # This can be any entity type key.
From 3240b4901747216a99a9fa690c73eec8b8fc905b Mon Sep 17 00:00:00 2001
From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com>
Date: Thu, 25 Jul 2024 17:11:58 +0100
Subject: [PATCH 07/16] Update entities.md
---
website/docs/docs/build/entities.md | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/website/docs/docs/build/entities.md b/website/docs/docs/build/entities.md
index f7f20728b63..4ff9d223dbb 100644
--- a/website/docs/docs/build/entities.md
+++ b/website/docs/docs/build/entities.md
@@ -100,7 +100,6 @@ entities:
expr: The field that denotes that entity (transaction_id). ## Optional
Defaults to name if unspecified.
```
-
Here's an example of how to define entities in a semantic model:
@@ -119,7 +118,6 @@ entities:
type: foreign
expr: substring(id_order from 2)
```
-
@@ -131,12 +129,10 @@ If a table doesn't have any key (like a primary key), use _surrogate combination
```yaml
+
entities:
- name: brand_target_key # Entity name or identified.
type: foreign # This can be any entity type key.
expr: date_key || '|' || brand_code # Defines the expression for linking fields to form the surrogate key.
```
-
-
-
From f6767d4c98ce66d6242924f3167560527df72ca7 Mon Sep 17 00:00:00 2001
From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com>
Date: Fri, 26 Jul 2024 11:34:14 +0100
Subject: [PATCH 08/16] Update entities.md
---
website/docs/docs/build/entities.md | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/website/docs/docs/build/entities.md b/website/docs/docs/build/entities.md
index 4ff9d223dbb..c73e75483d3 100644
--- a/website/docs/docs/build/entities.md
+++ b/website/docs/docs/build/entities.md
@@ -25,6 +25,8 @@ MetricFlow's join logic depends on the entity `type` you use and determines how
### Primary
A primary key has _only one_ record for each row in the table and includes every record in the data platform. It must contain unique values and can't contain null values. Use the primary key to ensure that each record in the table is distinct and identifiable.
+
+
For example, consider a table of employees with the following columns:
```sql
@@ -34,9 +36,13 @@ last_name
```
In this case, `employee_id` is the primary key. Each `employee_id` is unique and represents one specific employee. There can be no duplicate `employee_id` and can't be null.
+
+
### Unique
A unique key contains _only one_ record per row in the table but may have a subset of records in the data warehouse. However, unlike the primary key, a unique key allows for null values. The unique key ensures that the column's values are distinct, except for null values.
+
+
For example, consider a table of students with the following columns:
```sql
@@ -48,10 +54,14 @@ last_name
In this example, `email` is defined as a unique key. Each email address must be unique; however, multiple students can have null email addresses. This is because the unique key constraint allows for one or more null values, but non-null values must be unique. This then creates a set of records with unique emails (non-null) that could be a subset of the entire table, which includes all students.
+
+
### Foreign
A foreign key is a field (or a set of fields) in one table that uniquely identifies a row in another table. The foreign key establishes a link between the data in two tables.
It can include zero, one, or multiple instances of the same record. It can also contain null values.
+
+
For example, consider you have two tables, `customers` and `orders`:
customers table:
@@ -71,10 +81,14 @@ customer_id (foreign key)
In this example, the `customer_id` in the `orders` table is a foreign key that references the `customer_id` in the `customers` table. This link means each order is associated with a specific customer. However, not every order must have a customer; the `customer_id` in the orders table can be null or have the same `customer_id` for multiple orders.
+
+
### Natural
Natural keys are columns or combinations of columns in a table that uniquely identify a record based on real-world data. For instance, in a `sales_person_department` dimension table, the `sales_person_id` can serve as a natural key. You can only use natural keys for [SCD type II dimensions](/docs/build/dimensions#scd-type-ii).
+
+
For example, consider a table of `products` in an inventory system:
```sql
@@ -86,6 +100,8 @@ category
In this example, `product_code` serves as a natural key because it uniquely identifies each product in a real-world context, such as the stock-keeping unit (SKU) used by the company. It's based on the product's properties and has real-world meaning beyond the database system.
+
+
## Entities configuration
The following is the complete spec for entities:
From afa2ad94b763c0f1cb5028352ee9c4622bc995bb Mon Sep 17 00:00:00 2001
From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com>
Date: Fri, 26 Jul 2024 11:39:16 +0100
Subject: [PATCH 09/16] Update entities.md
---
website/docs/docs/build/entities.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/website/docs/docs/build/entities.md b/website/docs/docs/build/entities.md
index c73e75483d3..b555c718fc5 100644
--- a/website/docs/docs/build/entities.md
+++ b/website/docs/docs/build/entities.md
@@ -116,6 +116,7 @@ entities:
expr: The field that denotes that entity (transaction_id). ## Optional
Defaults to name if unspecified.
```
+
Here's an example of how to define entities in a semantic model:
@@ -141,7 +142,6 @@ entities:
If a table doesn't have any key (like a primary key), use _surrogate combination_ to form a key that will help you identify a record by combining two columns. This applies to any [entity type](/docs//build/entities#entity-types). For example, you can combine `date_key` and `brand_code` from the `raw_brand_target_weekly` table to form a _surrogate key_. The following example creates a surrogate key by joining `date_key` and `brand_code` using a pipe (`|`) as a separator.
-
```yaml
From 847798c6af8945b5b81206b5ac610bf26882a411 Mon Sep 17 00:00:00 2001
From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com>
Date: Fri, 26 Jul 2024 11:52:59 +0100
Subject: [PATCH 10/16] Update entities.md
---
website/docs/docs/build/entities.md | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/website/docs/docs/build/entities.md b/website/docs/docs/build/entities.md
index b555c718fc5..f695da03a59 100644
--- a/website/docs/docs/build/entities.md
+++ b/website/docs/docs/build/entities.md
@@ -106,8 +106,6 @@ In this example, `product_code` serves as a natural key because it uniquely iden
The following is the complete spec for entities:
-
-
```yaml
entities:
- name: transaction ## Required
@@ -117,11 +115,7 @@ entities:
Defaults to name if unspecified.
```
-
-
Here's an example of how to define entities in a semantic model:
-
-
```yaml
entities:
@@ -135,15 +129,11 @@ entities:
type: foreign
expr: substring(id_order from 2)
```
-
-
## Combine columns with a key
If a table doesn't have any key (like a primary key), use _surrogate combination_ to form a key that will help you identify a record by combining two columns. This applies to any [entity type](/docs//build/entities#entity-types). For example, you can combine `date_key` and `brand_code` from the `raw_brand_target_weekly` table to form a _surrogate key_. The following example creates a surrogate key by joining `date_key` and `brand_code` using a pipe (`|`) as a separator.
-
-
```yaml
entities:
@@ -151,4 +141,3 @@ entities:
type: foreign # This can be any entity type key.
expr: date_key || '|' || brand_code # Defines the expression for linking fields to form the surrogate key.
```
-
From 3375ad4c9337143bf3220b3523fb7059b74a3818 Mon Sep 17 00:00:00 2001
From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com>
Date: Fri, 26 Jul 2024 12:01:42 +0100
Subject: [PATCH 11/16] Update entities.md
---
website/docs/docs/build/entities.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/website/docs/docs/build/entities.md b/website/docs/docs/build/entities.md
index f695da03a59..7f3c9fa1fe7 100644
--- a/website/docs/docs/build/entities.md
+++ b/website/docs/docs/build/entities.md
@@ -88,7 +88,7 @@ In this example, the `customer_id` in the `orders` table is a foreign key that r
Natural keys are columns or combinations of columns in a table that uniquely identify a record based on real-world data. For instance, in a `sales_person_department` dimension table, the `sales_person_id` can serve as a natural key. You can only use natural keys for [SCD type II dimensions](/docs/build/dimensions#scd-type-ii).
-
+
For example, consider a table of `products` in an inventory system:
```sql
From 8967a013ba9c56d037ce97f19581ff7acc472edd Mon Sep 17 00:00:00 2001
From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com>
Date: Thu, 29 Aug 2024 09:52:52 +0100
Subject: [PATCH 12/16] Update entities.md
---
website/docs/docs/build/entities.md | 17 +----------------
1 file changed, 1 insertion(+), 16 deletions(-)
diff --git a/website/docs/docs/build/entities.md b/website/docs/docs/build/entities.md
index 78094a6a80d..9345e8034ad 100644
--- a/website/docs/docs/build/entities.md
+++ b/website/docs/docs/build/entities.md
@@ -85,22 +85,7 @@ In this example, the `customer_id` in the `orders` table is a foreign key that r
### Natural
-Natural keys are columns or combinations of columns in a table that uniquely identify a record based on real-world data. For instance, in a `sales_person_department` dimension table, the `sales_person_id` can serve as a natural key. You can only use natural keys for [SCD type II dimensions](/docs/build/dimensions#scd-type-ii).
-
-
-
-For example, consider a table of `products` in an inventory system:
-
-```sql
-product_code (natural key)
-product_name
-manufacturer
-category
-```
-
-In this example, `product_code` serves as a natural key because it uniquely identifies each product in a real-world context, such as the stock-keeping unit (SKU) used by the company. It's based on the product's properties and has real-world meaning beyond the database system.
-
-
+Natural keys are columns or combinations of columns in a table that uniquely identify a record based on real-world data. For instance, if you have a `sales_person_department` dimension table, the `sales_person_id` can serve as a natural key. You can only use natural keys for [SCD type II dimensions](/docs/build/dimensions#scd-type-ii).
## Entities configuration
From 256f13528ebec884eceb16282fc2333e68232f7e Mon Sep 17 00:00:00 2001
From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com>
Date: Thu, 29 Aug 2024 10:08:47 +0100
Subject: [PATCH 13/16] Update entities.md
---
website/docs/docs/build/entities.md | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/website/docs/docs/build/entities.md b/website/docs/docs/build/entities.md
index 9345e8034ad..44d6642a27d 100644
--- a/website/docs/docs/build/entities.md
+++ b/website/docs/docs/build/entities.md
@@ -12,7 +12,11 @@ Within a semantic graph, the required parameters for an entity are `name` and `t
Entities can be specified with a single column or multiple columns. Entities (join keys) in a semantic model are identified by their name. Each entity name must be unique within a semantic model, but it doesn't have to be unique across different semantic models.
-There are four entity types: primary, foreign, unique, or natural.
+There are four entity types:
+- [Primary](#primary) — Has only one record for each row in the table and includes every record in the data platform. This key uniquely identifies each record in the table.
+- [Foreign](#foreign) — Contains only one record per row in the table but may have a subset of records in the data warehouse. This key links to a primary key in another table, establishing relationships between tables.
+- [Unique](#unique) — A field (or a set of fields) in one table that uniquely identifies a row in another table. Ensures that no two rows have the same value in the specified column(s), maintaining data integrity.
+- [Natural](#natural) — Columns or combinations of columns in a table that uniquely identify a record based on real-world data. This key is derived from actual data attributes rather than artificially generated identifiers.
:::tip Use entities as dimensions
You can also use entities as dimensions, which allows you to aggregate a metric to the granularity of that entity.
From 315421ecc9ffc6bdbd0048042395f445acf08acf Mon Sep 17 00:00:00 2001
From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com>
Date: Thu, 29 Aug 2024 10:40:22 +0100
Subject: [PATCH 14/16] Update entities.md
---
website/docs/docs/build/entities.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/website/docs/docs/build/entities.md b/website/docs/docs/build/entities.md
index 44d6642a27d..8b387ddc882 100644
--- a/website/docs/docs/build/entities.md
+++ b/website/docs/docs/build/entities.md
@@ -14,9 +14,9 @@ Entities can be specified with a single column or multiple columns. Entities (jo
There are four entity types:
- [Primary](#primary) — Has only one record for each row in the table and includes every record in the data platform. This key uniquely identifies each record in the table.
-- [Foreign](#foreign) — Contains only one record per row in the table but may have a subset of records in the data warehouse. This key links to a primary key in another table, establishing relationships between tables.
-- [Unique](#unique) — A field (or a set of fields) in one table that uniquely identifies a row in another table. Ensures that no two rows have the same value in the specified column(s), maintaining data integrity.
-- [Natural](#natural) — Columns or combinations of columns in a table that uniquely identify a record based on real-world data. This key is derived from actual data attributes rather than artificially generated identifiers.
+- [Unique](#unique) — Contains only one record per row in the table but may have a subset of records in the data warehouse.
+- [Foreign](#foreign) — A field (or a set of fields) in one table that uniquely identifies a row in another table. This key links to a primary key in another table, establishing relationships between tables.
+- [Natural](#natural) — Columns or combinations of columns in a table that uniquely identify a record based on real-world data. This key is derived from actual data attributes.
:::tip Use entities as dimensions
You can also use entities as dimensions, which allows you to aggregate a metric to the granularity of that entity.
From a89871e58d1c1688e1ffe98781fa98eb08b00453 Mon Sep 17 00:00:00 2001
From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com>
Date: Thu, 29 Aug 2024 10:41:17 +0100
Subject: [PATCH 15/16] Update website/docs/docs/build/entities.md
---
website/docs/docs/build/entities.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/website/docs/docs/build/entities.md b/website/docs/docs/build/entities.md
index 8b387ddc882..2f79b466c15 100644
--- a/website/docs/docs/build/entities.md
+++ b/website/docs/docs/build/entities.md
@@ -14,7 +14,7 @@ Entities can be specified with a single column or multiple columns. Entities (jo
There are four entity types:
- [Primary](#primary) — Has only one record for each row in the table and includes every record in the data platform. This key uniquely identifies each record in the table.
-- [Unique](#unique) — Contains only one record per row in the table but may have a subset of records in the data warehouse.
+- [Unique](#unique) — Contains only one record per row in the table and allows for null values. May have a subset of records in the data warehouse.
- [Foreign](#foreign) — A field (or a set of fields) in one table that uniquely identifies a row in another table. This key links to a primary key in another table, establishing relationships between tables.
- [Natural](#natural) — Columns or combinations of columns in a table that uniquely identify a record based on real-world data. This key is derived from actual data attributes.
From d068e0ee3b3038e5d4ed403010c9360d5c4f0758 Mon Sep 17 00:00:00 2001
From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com>
Date: Thu, 29 Aug 2024 10:42:07 +0100
Subject: [PATCH 16/16] Update website/docs/docs/build/entities.md
---
website/docs/docs/build/entities.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/website/docs/docs/build/entities.md b/website/docs/docs/build/entities.md
index 2f79b466c15..e4ed0773c3c 100644
--- a/website/docs/docs/build/entities.md
+++ b/website/docs/docs/build/entities.md
@@ -15,7 +15,7 @@ Entities can be specified with a single column or multiple columns. Entities (jo
There are four entity types:
- [Primary](#primary) — Has only one record for each row in the table and includes every record in the data platform. This key uniquely identifies each record in the table.
- [Unique](#unique) — Contains only one record per row in the table and allows for null values. May have a subset of records in the data warehouse.
-- [Foreign](#foreign) — A field (or a set of fields) in one table that uniquely identifies a row in another table. This key links to a primary key in another table, establishing relationships between tables.
+- [Foreign](#foreign) — A field (or a set of fields) in one table that uniquely identifies a row in another table. This key establishes a link between tables.
- [Natural](#natural) — Columns or combinations of columns in a table that uniquely identify a record based on real-world data. This key is derived from actual data attributes.
:::tip Use entities as dimensions