This is an automated email from the ASF dual-hosted git repository. melap pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/beam-site.git
commit 93a09e4505a824a355d9381b8781c57869f9e333 Author: amaliujia <amaliu...@gmail.com> AuthorDate: Tue Sep 25 14:05:33 2018 -0700 update create table to create external table --- src/_includes/section-menu/sdks.html | 2 +- .../{create-table.md => create-external-table.md} | 32 ++++++++++++---------- src/documentation/dsls/sql/shell.md | 8 +++--- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/_includes/section-menu/sdks.html b/src/_includes/section-menu/sdks.html index 0102b4b..fc96033 100644 --- a/src/_includes/section-menu/sdks.html +++ b/src/_includes/section-menu/sdks.html @@ -64,7 +64,7 @@ <ul class="section-nav-list"> <li><a href="{{ site.baseurl }}/documentation/dsls/sql/data-types/">Data types</a></li> <li><a href="{{ site.baseurl }}/documentation/dsls/sql/lexical/">Lexical structure</a></li> - <li><a href="{{ site.baseurl }}/documentation/dsls/sql/create-table/">CREATE TABLE</a></li> + <li><a href="{{ site.baseurl }}/documentation/dsls/sql/create-external-table/">CREATE EXTERNAL TABLE</a></li> <li><a href="{{ site.baseurl }}/documentation/dsls/sql/select/">SELECT</a></li> <li><a href="{{ site.baseurl }}/documentation/dsls/sql/windowing-and-triggering/">Windowing & Triggering</a></li> <li><a href="{{ site.baseurl }}/documentation/dsls/sql/joins/">Joins</a></li> diff --git a/src/documentation/dsls/sql/create-table.md b/src/documentation/dsls/sql/create-external-table.md similarity index 89% rename from src/documentation/dsls/sql/create-table.md rename to src/documentation/dsls/sql/create-external-table.md index cfa1d2d..57c03f1 100644 --- a/src/documentation/dsls/sql/create-table.md +++ b/src/documentation/dsls/sql/create-external-table.md @@ -1,9 +1,11 @@ --- layout: section -title: "Beam SQL: CREATE TABLE Statement" +title: "Beam SQL: CREATE EXTERNAL TABLE Statement" section_menu: section-menu/sdks.html -permalink: /documentation/dsls/sql/create-table/ -redirect_from: /documentation/dsls/sql/statements/create-table/ +permalink: /documentation/dsls/sql/create-external-table/ +redirect_from: + -/documentation/dsls/sql/statements/create-table/ + -/documentation/dsls/sql/create-table/ --- <!-- Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,20 +21,20 @@ See the License for the specific language governing permissions and limitations under the License. --> -# CREATE TABLE +# CREATE EXTERNAL TABLE -Beam SQL's `CREATE TABLE` statement registers a virtual table that maps to an +Beam SQL's `CREATE EXTERNAL TABLE` statement registers a virtual table that maps to an [external storage system](https://beam.apache.org/documentation/io/built-in/). -For some storage systems, `CREATE TABLE` does not create a physical table until +For some storage systems, `CREATE EXTERNAL TABLE` does not create a physical table until a write occurs. After the physical table exists, you can access the table with the `SELECT`, `JOIN`, and `INSERT INTO` statements. -The `CREATE TABLE` statement includes a schema and extended clauses. +The `CREATE EXTERNAL TABLE` statement includes a schema and extended clauses. ## Syntax ``` -CREATE TABLE [ IF NOT EXISTS ] tableName (tableElement [, tableElement ]*) +CREATE EXTERNAL TABLE [ IF NOT EXISTS ] tableName (tableElement [, tableElement ]*) TYPE type [LOCATION location] [TBLPROPERTIES tblProperties] @@ -83,7 +85,7 @@ tableElement: columnName fieldType [ NOT NULL ] ### Syntax ``` -CREATE TABLE [ IF NOT EXISTS ] tableName (tableElement [, tableElement ]*) +CREATE EXTERNAL TABLE [ IF NOT EXISTS ] tableName (tableElement [, tableElement ]*) TYPE bigquery LOCATION '[PROJECT_ID]:[DATASET].[TABLE]' ``` @@ -183,7 +185,7 @@ as follows: ### Example ``` -CREATE TABLE users (id INTEGER, username VARCHAR) +CREATE EXTERNAL TABLE users (id INTEGER, username VARCHAR) TYPE bigquery LOCATION 'testing-integration:apache.users' ``` @@ -193,7 +195,7 @@ LOCATION 'testing-integration:apache.users' ### Syntax ``` -CREATE TABLE [ IF NOT EXISTS ] tableName +CREATE EXTERNAL TABLE [ IF NOT EXISTS ] tableName ( event_timestamp TIMESTAMP, attributes MAP<VARCHAR, VARCHAR>, @@ -263,7 +265,7 @@ declare a special set of columns, as shown below. ### Example ``` -CREATE TABLE locations (event_timestamp TIMESTAMP, attributes MAP<VARCHAR, VARCHAR>, payload ROW<id INTEGER, location VARCHAR>) +CREATE EXTERNAL TABLE locations (event_timestamp TIMESTAMP, attributes MAP<VARCHAR, VARCHAR>, payload ROW<id INTEGER, location VARCHAR>) TYPE pubsub LOCATION 'projects/testing-integration/topics/user-location' ``` @@ -275,7 +277,7 @@ KafkaIO is experimental in Beam SQL. ### Syntax ``` -CREATE TABLE [ IF NOT EXISTS ] tableName (tableElement [, tableElement ]*) +CREATE EXTERNAL TABLE [ IF NOT EXISTS ] tableName (tableElement [, tableElement ]*) TYPE kafka LOCATION 'kafka://localhost:2181/brokers' TBLPROPERTIES '{"bootstrap.servers":"localhost:9092", "topics": ["topic1", "topic2"]}' @@ -313,7 +315,7 @@ access the same underlying data. ### Syntax ``` -CREATE TABLE [ IF NOT EXISTS ] tableName (tableElement [, tableElement ]*) +CREATE EXTERNAL TABLE [ IF NOT EXISTS ] tableName (tableElement [, tableElement ]*) TYPE text LOCATION '/home/admin/orders' TBLPROPERTIES '{"format: "Excel"}' @@ -345,7 +347,7 @@ Only simple types are supported. ### Example ``` -CREATE TABLE orders (id INTEGER, price INTEGER) +CREATE EXTERNAL TABLE orders (id INTEGER, price INTEGER) TYPE text LOCATION '/home/admin/orders' ``` diff --git a/src/documentation/dsls/sql/shell.md b/src/documentation/dsls/sql/shell.md index 6f9c32c..4ef670a 100644 --- a/src/documentation/dsls/sql/shell.md +++ b/src/documentation/dsls/sql/shell.md @@ -59,17 +59,17 @@ The shell converts the queries into Beam pipelines, runs them using `DirectRunne ## Declaring Tables -Before reading data from a source or writing data to a destination, you must declare a virtual table using the `CREATE TABLE` statement. For example, if you have a local CSV file `"test-file.csv"` in the current folder, you can create a table with the following statement: +Before reading data from a source or writing data to a destination, you must declare a virtual table using the `CREATE EXTERNAL TABLE` statement. For example, if you have a local CSV file `"test-file.csv"` in the current folder, you can create a table with the following statement: ``` -0: BeamSQL> CREATE TABLE csv_file (field1 VARCHAR, field2 INTEGER) TYPE text LOCATION 'test-file.csv'; +0: BeamSQL> CREATE EXTERNAL TABLE csv_file (field1 VARCHAR, field2 INTEGER) TYPE text LOCATION 'test-file.csv'; No rows affected (0.042 seconds) ``` -The `CREATE TABLE` statement registers the CSV file as a table in Beam SQL and specifies the table's schema. This statement does not directly create a persistent physical table; it only describes the source/sink to Beam SQL so that you can use the table in the queries that read data and write data. +The `CREATE EXTERNAL TABLE` statement registers the CSV file as a table in Beam SQL and specifies the table's schema. This statement does not directly create a persistent physical table; it only describes the source/sink to Beam SQL so that you can use the table in the queries that read data and write data. -_For more information about `CREATE TABLE` syntax and supported table types, see the [CREATE TABLE reference page]({{ site.baseurl }}/documentation/dsls/sql/create-table/)._ +_For more information about `CREATE EXTERNAL TABLE` syntax and supported table types, see the [CREATE EXTERNAL TABLE reference page]({{ site.baseurl }}/documentation/dsls/sql/create-external-table/)._ ## Reading and Writing Data