From 8595ece40d18611b003b70f4e62d90c615349abd Mon Sep 17 00:00:00 2001 From: GraceH Date: Sat, 20 Aug 2016 11:22:59 +0800 Subject: [PATCH 1/2] Documenting jdbcWriter options --- docs/sql-programming-guide.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/sql-programming-guide.md b/docs/sql-programming-guide.md index c89286d0e49d0..4d0b0fde280c7 100644 --- a/docs/sql-programming-guide.md +++ b/docs/sql-programming-guide.md @@ -1058,6 +1058,20 @@ the Data Sources API. The following options are supported: The JDBC fetch size, which determines how many rows to fetch per round trip. This can help performance on JDBC drivers which default to low fetch size (eg. Oracle with 10 rows). + + + truncate + + This is a JDBC writer related option. To truncate the existing table before inserting the new data. This option only works with SaveMode.Overwrite. Without this option, Spark will drop the entire table, including its table definitions as well. truncate way is more efficient and ideal for cleaning out data from existing temp table. Its default value is false. + + + + + createTableOptions + + This is a JDBC writer related option. To allow certain options to append when creating a new table, which can be table_options or partition_options. E.g., CREATE TABLE t (name string) ENGINE=InnoDB . By default, it is empty string. + +
From e9245e132274fc8aff38f887cdd71d37d40ee33c Mon Sep 17 00:00:00 2001 From: GraceH Date: Sun, 21 Aug 2016 19:10:15 +0800 Subject: [PATCH 2/2] revise the description to describe the reason why to use those options --- docs/sql-programming-guide.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sql-programming-guide.md b/docs/sql-programming-guide.md index 4d0b0fde280c7..28cc88c322b7e 100644 --- a/docs/sql-programming-guide.md +++ b/docs/sql-programming-guide.md @@ -1062,14 +1062,14 @@ the Data Sources API. The following options are supported: truncate - This is a JDBC writer related option. To truncate the existing table before inserting the new data. This option only works with SaveMode.Overwrite. Without this option, Spark will drop the entire table, including its table definitions as well. truncate way is more efficient and ideal for cleaning out data from existing temp table. Its default value is false. + This is a JDBC writer related option. When SaveMode.Overwrite is enabled, this option causes Spark to truncate an existing table instead of dropping and recreating it. This can be more efficient, and prevents the table metadata (e.g. indices) from being removed. However, it will not work in some cases, such as when the new data has a different schema. It defaults to false. createTableOptions - This is a JDBC writer related option. To allow certain options to append when creating a new table, which can be table_options or partition_options. E.g., CREATE TABLE t (name string) ENGINE=InnoDB . By default, it is empty string. + This is a JDBC writer related option. If specified, this option allows setting of database-specific table and partition options when creating a table. For example: CREATE TABLE t (name string) ENGINE=InnoDB.