Skip to content

Apache DataFusion SQL Query Engine

DML documentation (#7362)

Seth Paydarb6fe8159fd21
diff --git a/docs/source/user-guide/sql/dml.md b/docs/source/user-guide/sql/dml.md
new file mode 100644
index 0000000000..26f291c15a
--- /dev/null
+++ b/docs/source/user-guide/sql/dml.md
@@ -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 |
++-------+
+```
diff --git a/docs/source/user-guide/sql/index.rst b/docs/source/user-guide/sql/index.rst
index 00fd20c7b7..b282fbddd6 100644
--- a/docs/source/user-guide/sql/index.rst
+++ b/docs/source/user-guide/sql/index.rst
@@ -25,6 +25,7 @@ SQL Reference
select
subqueries
ddl
+ dml
explain
information_schema
operators