Table action property
Use the Table action property to configure the connector to complete create, replace, and truncate actions on a table at run time. These actions are completed before any data is written to the table.
Usage
You can set the Table action property to the values that are listed in the following table.
Value | Description |
---|---|
Append | No action is completed on the table. This option is the default. |
Create | Create a table at run time. Use one of these methods to specify the CREATE TABLE statement:
|
Replace | Replace a table at run time. Use one of these methods to specify the DROP TABLE statement:
Use one of these methods to specify the CREATE TABLE statement:
|
Truncate | Truncate a table at run time. Use one of these methods to specify the TRUNCATE TABLE statement:
|
- Abort when create table statement fails
- Abort when drop table statement fails
- Abort when truncate table statement fails
The connector supports additional options when the Table action mode is either configured as Create or Replace and the Generate create table option at runtime is set to Yes. For more information about additional supported options, refer to the following table:
Value | Description |
---|---|
Row format |
Use the Row format option to specify the row format of the table created. This option supports the following different values:
|
Data Storage format |
This property supports six different file formats for storing data on Hive:
|
Table location | Use this option to specify the location of the directory that serves as the storage for the Hive table. By default you can leave this option blank. When the connector passes a blank value for the location, Hive server uses the default location for the Hive tables configured in the Hive servers. |
Field Terminator | This property is enabled when Row format is selected as "Delimited". It is an optional property. |
Line Terminator | This property is enabled when Row format is selected as “Delimited”. It is an optional property. |
SerdeLibrary | This property is enabled when Row format is selected as “SerDe”. Specify the Seder library name to create the table. |
Properties | Create table statement |
---|---|
Generate create statement = Yes, RowFormat=Delimited, Field Terminator=\054, Line Terminator=\n |
CREATE TABLE test_table_action_1 (c1 int, c2 string) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\054' LINES TERMINATED BY '\n' STORED AS TEXTFILE |
Generate create statement = Yes, RowFormat=SerDe, Serde Library =org.apache.hadoop.hive.serde2.columnar.ColumnarSerDe, StorageFormat=AVRO |
CREATE TABLE test_table_action_2 (c1 int, c2 string) ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.columnar.ColumnarSerDe' STORED AS AVRO |
Generate create statement = Yes, RowFormat=StorageFormat, StorageFormat =RCFile, Location=/apps/hive/test_table_action_3 |
CREATE TABLE test_table_action_3 (c1 int, c2 string) STORED AS RCFILE LOCATION '/apps/hive/test_table_action_3' |