> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinetica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# /append/records

```
URL: http://<db.host>:<db.port>/append/records
```

Append (or insert) all records from a source table (specified by input
parameter *source\_table\_name*) to a particular target table (specified by input
parameter *table\_name*). The field map (specified by input parameter
*field\_map*) holds the user specified map of target table column names with
their mapped source column names.

## Input Parameter Description

<ParamField body="table_name" type="string">
  The table name for the records to be appended, in \[schema\_name.]table\_name format, using standard [name resolution rules](../../concepts/tables/#table-name-resolution). Must be an existing table.
</ParamField>

<ParamField body="source_table_name" type="string">
  The source table name to get records from, in \[schema\_name.]table\_name format, using standard [name resolution rules](../../concepts/tables/#table-name-resolution). Must be an existing table name.
</ParamField>

<ParamField body="field_map" type="map of string to strings">
  Contains the mapping of column names from the target table (specified by input parameter *table\_name*) as the keys, and corresponding column names or expressions (e.g., 'col\_name+1') from the source table (specified by input parameter *source\_table\_name*). Must be existing column names in source table and target table, and their types must be matched. For details on using expressions, see [Expressions](../../concepts/expressions/).
</ParamField>

<ParamField body="options" type="map of string to strings">
  Optional parameters.

  The default value is an empty map ( \{} ).

  <Expandable title="options">
    <ParamField body="offset">
      A positive integer indicating the number of initial results to skip from input parameter *source\_table\_name*. Default is 0. The minimum allowed value is 0. The maximum allowed value is MAX\_INT.

      The default value is `0`.
    </ParamField>

    <ParamField body="limit">
      A positive integer indicating the maximum number of results to be returned from input parameter *source\_table\_name*. Or END\_OF\_SET (-9999) to indicate that the max number of results should be returned.

      The default value is `-9999`.
    </ParamField>

    <ParamField body="expression">
      Filter expression to apply to the input parameter *source\_table\_name*.

      The default value is ''.
    </ParamField>

    <ParamField body="order_by">
      Comma-separated list of the columns to be sorted by from source table (specified by input parameter *source\_table\_name*), e.g., 'timestamp asc, x desc'. The *order\_by* columns do not have to be present in input parameter *field\_map*.

      The default value is ''.
    </ParamField>

    <ParamField body="update_on_existing_pk">
      Specifies the record collision policy for inserting source table records (specified by input parameter *source\_table\_name*) into a target table (specified by input parameter *table\_name*) with a [primary key](../../concepts/tables/#primary-keys). If set to *true*, 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 to *false*, 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 by *ignore\_existing\_pk*.  If the specified table does not have a primary key, then this option has no effect.

      The default value is `false`.

      * **true**: Upsert new records when primary keys match existing records.
      * **false**: Reject new records when primary keys match existing records.
    </ParamField>

    <ParamField body="ignore_existing_pk">
      Specifies the record collision error-suppression policy for inserting source table records (specified by input parameter *source\_table\_name*) into a target table (specified by input parameter *table\_name*) with a [primary key](../../concepts/tables/#primary-keys), only used when not in upsert mode (upsert mode is disabled when *update\_on\_existing\_pk* is *false*).  If set to *true*, 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.  If *false*, 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\_pk* is *true*), then this option has no effect.

      The default value is `false`.

      * **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.
    </ParamField>

    <ParamField body="pk_conflict_predicate_higher">
      The record with higher value for the column resolves the primary-key insert conflict.

      The default value is ''.
    </ParamField>

    <ParamField body="pk_conflict_predicate_lower">
      The record with lower value for the column resolves the primary-key insert conflict.

      The default value is ''.
    </ParamField>

    <ParamField body="truncate_strings">
      If set to *true*, it allows inserting longer strings into smaller charN string columns by truncating the longer strings to fit.

      The default value is `false`.

      The supported values are:

      * true
      * false
    </ParamField>
  </Expandable>
</ParamField>

## Output Parameter Description

The Kinetica server embeds the endpoint response inside a standard response structure which contains status information and the actual response to the query.  Here is a description of the various fields of the wrapper:

<ResponseField name="status" type="String">
  'OK' or 'ERROR'
</ResponseField>

<ResponseField name="message" type="String">
  Empty if success or an error message
</ResponseField>

<ResponseField name="data_type" type="String">
  'append\_records\_response' or 'none' in case of an error
</ResponseField>

<ResponseField name="data" type="String">
  Empty string
</ResponseField>

<ResponseField name="data_str" type="JSON or String">
  This embedded JSON represents the result of the /append/records endpoint:

  <Expandable title="data_str">
    <ResponseField name="table_name" type="string" />

    <ResponseField name="info" type="map of string to strings">
      Additional information.

      The default value is an empty map ( \{} ).
    </ResponseField>
  </Expandable>

  Empty string in case of an error.
</ResponseField>
