Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DML documentation #7362

Merged
merged 4 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions docs/source/user-guide/sql/dml.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<!---
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`.

<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>
spaydar marked this conversation as resolved.
Show resolved Hide resolved
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 'table' (FORMAT parquet, PER_THREAD_OUTPUT true);
spaydar marked this conversation as resolved.
Show resolved Hide resolved
+-------+
| 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 source_table VALUES (1, 'Foo'), (2, 'Bar');
spaydar marked this conversation as resolved.
Show resolved Hide resolved
+-------+
| count |
+-------+
| 2 |
+-------+
```
1 change: 1 addition & 0 deletions docs/source/user-guide/sql/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ SQL Reference
select
subqueries
ddl
dml
explain
information_schema
operators
Expand Down