浏览代码

HUE-9191 [blog] Adding reference to foreign keys

Romain 5 年之前
父节点
当前提交
b736152907

+ 27 - 0
docs/docs-site/content/user/querying/_index.md

@@ -182,6 +182,33 @@ Here is an example of SQL for using them:
     TBLPROPERTIES ('kudu.num_tablet_replicas' = '1')
     TBLPROPERTIES ('kudu.num_tablet_replicas' = '1')
     ;
     ;
 
 
+## Foreign Keys
+
+When a column value points to another column in another table. e.g. The head of the business unit must exist in the person table:
+
+![Assist Foreign Keys](https://cdn.gethue.com/uploads/2020/03/assist_foreign_keys_icons.png)
+
+
+    CREATE TABLE person (
+      id INT NOT NULL,
+      name STRING NOT NULL,
+      age INT,
+      creator STRING DEFAULT CURRENT_USER(),
+      created_date DATE DEFAULT CURRENT_DATE(),
+
+      PRIMARY KEY (id) DISABLE NOVALIDATE
+    );
+
+    CREATE TABLE business_unit (
+      id INT NOT NULL,
+      head INT NOT NULL,
+      creator STRING DEFAULT CURRENT_USER(),
+      created_date DATE DEFAULT CURRENT_DATE(),
+
+      PRIMARY KEY (id) DISABLE NOVALIDATE,
+      CONSTRAINT fk FOREIGN KEY (head) REFERENCES person(id) DISABLE NOVALIDATE
+    );
+
 #### Partition Keys
 #### Partition Keys
 
 
 Partitioning of the data is a key concept for optimizing the querying. Those special columns are also shown with a key icon:
 Partitioning of the data is a key concept for optimizing the querying. Those special columns are also shown with a key icon:

+ 27 - 0
docs/gethue/content/en/posts/2019-11-13-sql-column-keys-information.md

@@ -52,6 +52,7 @@ Here is a tutorial demoing how Hue's SQL Editor helps you quickly visualize and
 
 
 ![Assist All Keys](https://cdn.gethue.com/uploads/2019/11/sql_column_pk.png)
 ![Assist All Keys](https://cdn.gethue.com/uploads/2019/11/sql_column_pk.png)
 
 
+*Updated March 2020*
 
 
 ## Primary Keys
 ## Primary Keys
 
 
@@ -80,6 +81,32 @@ Here is an example of SQL for using them:
     TBLPROPERTIES ('kudu.num_tablet_replicas' = '1')
     TBLPROPERTIES ('kudu.num_tablet_replicas' = '1')
     ;
     ;
 
 
+## Foreign Keys
+
+When a column value points to another column in another table. e.g. The head of the business unit must exist in the person table:
+
+![Assist Foreign Keys](https://cdn.gethue.com/uploads/2020/03/assist_foreign_keys_icons.png)
+
+    CREATE TABLE person (
+      id INT NOT NULL,
+      name STRING NOT NULL,
+      age INT,
+      creator STRING DEFAULT CURRENT_USER(),
+      created_date DATE DEFAULT CURRENT_DATE(),
+
+      PRIMARY KEY (id) DISABLE NOVALIDATE
+    );
+
+    CREATE TABLE business_unit (
+      id INT NOT NULL,
+      head INT NOT NULL,
+      creator STRING DEFAULT CURRENT_USER(),
+      created_date DATE DEFAULT CURRENT_DATE(),
+
+      PRIMARY KEY (id) DISABLE NOVALIDATE,
+      CONSTRAINT fk FOREIGN KEY (head) REFERENCES person(id) DISABLE NOVALIDATE
+    );
+
 ## Partition Keys
 ## Partition Keys
 
 
 Partitioning of the data is a key concept for optimizing the querying. Those special columns are also shown with a key icon:
 Partitioning of the data is a key concept for optimizing the querying. Those special columns are also shown with a key icon:

+ 1 - 0
tools/ci/check_for_website_dead_links.sh

@@ -51,6 +51,7 @@ if [ "$?" -eq "0" ];
     kill $HUGO_PID
     kill $HUGO_PID
   else
   else
     echo "No documentation change"
     echo "No documentation change"
+    LINT_EXIT_CODE=0
 fi
 fi
 
 
 exit $LINT_EXIT_CODE
 exit $LINT_EXIT_CODE