From 01c7c6b884244ac1a57e332c3aea669488ad9dc0 Mon Sep 17 00:00:00 2001
From: c-sahuja <sahuja@cloudera.com>
Date: Tue, 6 Dec 2016 19:03:23 -0800
Subject: [PATCH] Update Spark documentation to provide information on how to
 create External Table

## What changes were proposed in this pull request?
Although, currently, the saveAsTable does not provide an API to save the table as an external table from a DataFrame, we can achieve this functionality by using options on DataFrameWriter where the key for the map is the String: "path" and the value is another String which is the location of the external table itself. This can be provided before the call to saveAsTable is performed.

## How was this patch tested?
Documentation was reviewed for formatting and content after the push was performed on the branch.
![updated documentation](https://cloud.githubusercontent.com/assets/15376052/20953147/4cfcf308-bc57-11e6-807c-e21fb774a760.PNG)

Author: c-sahuja <sahuja@cloudera.com>

Closes #16185 from c-sahuja/createExternalTable.
---
 docs/sql-programming-guide.md | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/docs/sql-programming-guide.md b/docs/sql-programming-guide.md
index e59c327915..6287e2be95 100644
--- a/docs/sql-programming-guide.md
+++ b/docs/sql-programming-guide.md
@@ -526,6 +526,11 @@ By default `saveAsTable` will create a "managed table", meaning that the locatio
 be controlled by the metastore. Managed tables will also have their data deleted automatically
 when a table is dropped.
 
+Currently, `saveAsTable` does not expose an API supporting the creation of an "External table" from a `DataFrame`, 
+however, this functionality can be achieved by providing a `path` option to the `DataFrameWriter` with `path` as the key 
+and location of the external table as its value (String) when saving the table with `saveAsTable`. When an External table 
+is dropped only its metadata is removed.
+
 ## Parquet Files
 
 [Parquet](http://parquet.io) is a columnar format that is supported by many other data processing systems.
-- 
GitLab