Merge Records

Create a new empty result table (specified by input parameter table_name), and insert all records from source tables (specified by input parameter source_table_names) based on the field mapping information (specified by input parameter field_maps).

For merge records details and examples, see Merge Records. For limitations, see Merge Records Limitations and Cautions.

The field map (specified by input parameter field_maps) holds the user-specified maps of target table column names to source table columns. The array of input parameter field_maps must match one-to-one with the input parameter source_table_names, e.g., there's a map present in input parameter field_maps for each table listed in input parameter source_table_names.

Input Parameter Description

NameTypeDescription
table_namestringThe name of the new result table for the records to be merged into, in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria. Must NOT be an existing table.
source_table_namesarray of stringsThe list of names of source tables to get the records from, each in [schema_name.]table_name format, using standard name resolution rules. Must be existing table names.
field_mapsarray of maps of string to stringsContains a list of source/target column mappings, one mapping for each source table listed in input parameter source_table_names being merged into the target table specified by input parameter table_name. Each mapping contains the target column names (as keys) that the data in the mapped source columns or column expressions (as values) will be merged into. All of the source columns being merged into a given target column must match in type, as that type will determine the type of the new target column.
optionsmap of string to strings

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

Supported Parameters (keys)Parameter Description
create_temp_table

If true, a unique temporary table name will be generated in the sys_temp schema and used in place of input parameter table_name. If persist is false, then this is always allowed even if the caller does not have permission to create tables. The generated name is returned in qualified_table_name. The default value is false. The supported values are:

  • true
  • false
collection_name[DEPRECATED--please specify the containing schema for the merged table as part of input parameter table_name and use Create Schema to create the schema if non-existent] Name of a schema for the newly created merged table specified by input parameter table_name.
is_replicated

Indicates the distribution scheme for the data of the merged table specified in input parameter table_name. If true, the table will be replicated. If false, the table will be randomly sharded. The default value is false. The supported values are:

  • true
  • false
ttlSets the TTL of the merged table specified in input parameter table_name.
persist

If true, then the table specified in input parameter table_name will be persisted and will not expire unless a ttl is specified. If false, then the table will be an in-memory table and will expire unless a ttl is specified otherwise. The default value is true. The supported values are:

  • true
  • false
chunk_sizeIndicates the number of records per chunk to be used for the merged table specified in input parameter table_name.
chunk_column_max_memoryIndicates the target maximum data size for each column in a chunk to be used for the merged table specified in input parameter table_name.
chunk_max_memoryIndicates the target maximum data size for all columns in a chunk to be used for the merged table specified in input parameter table_name.
view_idview this result table is part of. The default value is ''.

Output Parameter Description

NameTypeDescription
table_namestring 
infomap of string to strings

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

Possible Parameters (keys)Parameter Description
qualified_table_nameThe fully qualified name of the result table (i.e. including the schema)