Purpose
To define an HCatalog table as a target of records.
Format
/HCATOUTPUT database table_loadwhere
table_load | = | TABLE dbtable [disposition] COLUMNS columnlist |
disposition | = | {INSERT} |
columnlist | = | column=value [,column=value...] |
value | = | {fieldname | valuename} |
Arguments
database | The alias of an hcatalog connection defined through /HCATCONNECTION. |
dbtable | The name of the table in database that is the target of records. The name can be in the form of a string or identifier. |
column | The name of a column to be written in the table. The name can be in the form of a string or identifier. |
fieldname | A field defined in the task |
valuename | A value defined in the task |
Location
The option may appear anywhere in the task definition.
Notes
Mapping Fields to Table Columns
You can map a field to a table column as long as their data types are compatible. See the topic Conversion between HCatalog data types and Connect ETL data types in the Connect help for details.
When the target table is created with partitions, there must be a mapping for each partition column, and the mapped value or field cannot be null or empty. The records are partitioned on the value(s) of the mapped entity. Constant values can be specified using the notation for constants described in Appendix B Constants.
Nullable columns
When a NULL value is output to an HCatalog table column that is not nullable, the record is rejected and dmexpress aborts. To avoid this, you can define an explicit representation for NULL values by using a conditional /VALUE option, and then referencing the named value definition instead of referencing the nullable column directly.
Existence of target database table
The target table must exist prior to running the task.
Disposition
You can specify the action Connect ETL is to take when there are already rows in the table. Currently, INSERT is the only supported disposition for HCatalog tables.
Insert only
To preserve any rows already in the table and insert the target records as additional rows, specify the INSERT disposition. This is the default disposition.
Using a target database table in a program
You cannot use /HCATOUTPUT when running dmexpress from a program.
Obtaining Target Record Number
To obtain a target record number, create and call the dmexpress target record function, TargetRecordNumber().
Examples
/HCAToutput hcat_emp_db TABLE contact_info COLUMNS cell_no = cell_phone
/HCATOUTPUT hcat_company_db TABLE company_info COLUMNS id =
FileInputRecordlayout.id, name = FileInputRecordLayout.name, type = "public"
This option specifies writing to partitioned table company_info in the database hcat_company_db with records partitioned on the "name" partition column with values of FileInputRecordlayout.name and on the "type" partition column with value "public".