-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* docs: SQL DML * docs: COPY DML * docs: INSERT DML * docs: clarify DML examples
- Loading branch information
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<!--- | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
--> | ||
|
||
# DML | ||
|
||
## COPY | ||
|
||
Copy a table to file(s). Supported file formats are `parquet`, `csv`, and `json`. | ||
|
||
The `PER_THREAD_OUTPUT` option treats `file_name` as a directory and writes a file per thread within it. | ||
|
||
<pre> | ||
COPY <i><b>table_name</i></b> TO '<i><b>file_name</i></b>' [ ( <i><b>option</i></b> [, ... ] ) ] | ||
|
||
where <i><b>option</i></b> can be one of: | ||
FORMAT <i><b>format_name</i></b> | ||
PER_THREAD_OUTPUT <i><b>boolean</i></b> | ||
ROW_GROUP_SIZE <i><b>integer</i></b> | ||
ROW_GROUP_LIMIT_BYTES <i><b>integer</i></b> | ||
</pre> | ||
|
||
```sql | ||
> COPY source_table TO 'file_name.json'; | ||
+-------+ | ||
| count | | ||
+-------+ | ||
| 2 | | ||
+-------+ | ||
|
||
> COPY source_table TO 'dir_name' (FORMAT parquet, PER_THREAD_OUTPUT true); | ||
+-------+ | ||
| count | | ||
+-------+ | ||
| 2 | | ||
+-------+ | ||
``` | ||
|
||
## INSERT | ||
|
||
Insert values into a table. | ||
|
||
<pre> | ||
INSERT INTO <i><b>table_name</i></b> { VALUES ( <i><b>expression</i></b> [, ...] ) [, ...] | <i><b>query</i></b> } | ||
</pre> | ||
|
||
```sql | ||
> INSERT INTO target_table VALUES (1, 'Foo'), (2, 'Bar'); | ||
+-------+ | ||
| count | | ||
+-------+ | ||
| 2 | | ||
+-------+ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ SQL Reference | |
select | ||
subqueries | ||
ddl | ||
dml | ||
explain | ||
information_schema | ||
operators | ||
|