[ https://issues.apache.org/jira/browse/BEAM-5506?focusedWorklogId=148865&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-148865 ]
ASF GitHub Bot logged work on BEAM-5506: ---------------------------------------- Author: ASF GitHub Bot Created on: 27/Sep/18 19:46 Start Date: 27/Sep/18 19:46 Worklog Time Spent: 10m Work Description: asfgit closed pull request #562: [BEAM-5506] update create table to create external table URL: https://github.com/apache/beam-site/pull/562 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/src/_includes/section-menu/sdks.html b/src/_includes/section-menu/sdks.html index 0102b4bd9b..fc9603304d 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 cfa1d2d1ec..57c03f1c21 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 6f9c32cf18..4ef670a415 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 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 148865) Time Spent: 1h (was: 50m) > Update Beam documentation > ------------------------- > > Key: BEAM-5506 > URL: https://issues.apache.org/jira/browse/BEAM-5506 > Project: Beam > Issue Type: Sub-task > Components: dsl-sql > Reporter: Rui Wang > Assignee: Rui Wang > Priority: Major > Time Spent: 1h > Remaining Estimate: 0h > -- This message was sent by Atlassian JIRA (v7.6.3#76005)