appendRecords
Append (or insert) all records from a source table (specified bysourceTableName) to a particular target table (specified bytableName). The field map (specified byfieldMap) holds the user specified map of target table column names with their mapped source column names.Parameters:request-Requestobject containing the parameters for the operation.Returns:Responseobject containing the results of the operation.Throws:GPUdbException- if an error occurs during the operation.appendRecords
public AppendRecordsResponse appendRecords(String tableName, String sourceTableName, Map<String, String> fieldMap, Map<String, String> options) throws GPUdbException Append (or insert) all records from a source table (specified bysourceTableName) to a particular target table (specified bytableName). The field map (specified byfieldMap) holds the user specified map of target table column names with their mapped source column names.Parameters:tableName- The table name for the records to be appended, in [schema_name.]table_name format, using standard name resolution rules. Must be an existing table.sourceTableName- The source table name to get records from, in [schema_name.]table_name format, using standard name resolution rules. Must be an existing table name.fieldMap- Contains the mapping of column names from the target table (specified bytableName) as the keys, and corresponding column names or expressions (e.g., ‘col_name+1’) from the source table (specified bysourceTableName). Must be existing column names in source table and target table, and their types must be matched. For details on using expressions, see Expressions.options- Optional parameters.OFFSET: A positive integer indicating the number of initial results to skip fromsourceTableName. Default is 0. The minimum allowed value is 0. The maximum allowed value is MAX_INT. The default value is ‘0’.LIMIT: A positive integer indicating the maximum number of results to be returned fromsourceTableName. Or END_OF_SET (-9999) to indicate that the max number of results should be returned. The default value is ‘-9999’.EXPRESSION: Filter expression to apply to thesourceTableName. The default value is ”.ORDER_BY: Comma-separated list of the columns to be sorted by from source table (specified bysourceTableName), e.g., ‘timestamp asc, x desc’. TheORDER_BYcolumns do not have to be present infieldMap. The default value is ”.ERROR_HANDLING: Specifies how record errors are handled while appending source table records into the target table. Currently this governs primary-key collision behavior:SKIPandPERMISSIVEdrop the colliding source records and continue, whileABORTrejects the batch. ExplicitUPDATE_ON_EXISTING_PKorIGNORE_EXISTING_PKtake precedence over this option. Supported values:PERMISSIVE: Source records that cannot be appended (e.g. a primary-key collision) are skipped and reported; the rest of the batch is appended.SKIP: Source records that cannot be appended are skipped and reported; the rest of the batch is appended.ABORT: A source record that cannot be appended (e.g. a primary-key collision) raises an error. This is the default.
ABORT.UPDATE_ON_EXISTING_PK: Specifies the record collision policy for inserting source table records (specified bysourceTableName) into a target table (specified bytableName) with a primary key. If set toTRUE, any existing table record with primary key values that match those of a source table record being inserted will be replaced by that new record (the new data will be “upserted”). If set toFALSE, any existing table record with primary key values that match those of a source table record being inserted will remain unchanged, while the source record will be rejected and an error handled as determined byIGNORE_EXISTING_PK. If the specified table does not have a primary key, then this option has no effect. Supported values:TRUE: Upsert new records when primary keys match existing records.FALSE: Reject new records when primary keys match existing records.
FALSE.ENABLE_INPLACE_UPDATES: Applies only when upserting (whenUPDATE_ON_EXISTING_PKisTRUE). If set toTRUE, an existing record matched by primary key is modified in place. If set toFALSE, it is updated by deleting the existing record and inserting a replacement (delete and insert), which prevents the change from being reflected in dependent materialized views until they are refreshed. Supported values:The default value isTRUE.IGNORE_EXISTING_PK: Specifies the record collision error-suppression policy for inserting source table records (specified bysourceTableName) into a target table (specified bytableName) with a primary key, only used when not in upsert mode (upsert mode is disabled whenUPDATE_ON_EXISTING_PKisFALSE). If set toTRUE, any source table record being inserted that is rejected for having primary key values that match those of an existing target table record will be ignored with no error generated. IfFALSE, the rejection of any source table record for having primary key values matching an existing target table record will result in an error being raised. If the specified table does not have a primary key or if upsert mode is in effect (UPDATE_ON_EXISTING_PKisTRUE), then this option has no effect. Supported values:TRUE: Ignore source table records whose primary key values collide with those of target table records.FALSE: Raise an error for any source table record whose primary key values collide with those of a target table record.
FALSE.PK_CONFLICT_PREDICATE_HIGHER: The record with higher value for the column resolves the primary-key insert conflict. The default value is ”.PK_CONFLICT_PREDICATE_LOWER: The record with lower value for the column resolves the primary-key insert conflict. The default value is ”.TRUNCATE_STRINGS: If set toTRUE, it allows inserting longer strings into smaller charN string columns by truncating the longer strings to fit. Supported values:The default value isFALSE.
Map.Returns:Responseobject containing the results of the operation.Throws:GPUdbException- if an error occurs during the operation.