Merges data from one or more tables with comparable data types into a new table.
The following merges are supported:
UNION (DISTINCT/ALL) - For data set union details and examples, see Union. For limitations, see Union Limitations and Cautions.
INTERSECT (DISTINCT/ALL) - For data set intersection details and examples, see Intersect. For limitations, see Intersect Limitations.
EXCEPT (DISTINCT/ALL) - For data set subtraction details and examples, see Except. For limitations, see Except Limitations.
Parameters
Name of the table to be created, in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria.
The list of table names to merge, in [schema_name.]table_name format, using standard name resolution rules. Must contain the names of one or more existing tables. The user can provide a single element (which will be automatically promoted to a list internally) or a list.
The list of columns from each of the corresponding input tables. The user can provide a single element (which will be automatically promoted to a list internally) or a list.
The list of names of the columns to be stored in the output table. The user can provide a single element (which will be automatically promoted to a list internally) or a list.
Optional parameters. Allowed keys are:
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 (or unspecified), 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. Allowed values are:
true
false
The default value is ‘false’.
collection_name – [DEPRECATED–please specify the containing schema for the projection as part of input parameter table_name and use
GPUdb.create_schema()to create the schema if non-existent] Name of the schema for the output table. If the schema provided is non-existent, it will be automatically created. The default value is ‘’.mode – The mode describes what rows of the tables being unioned will be retained. Allowed values are:
union_all – Retains all rows from the specified tables.
union – Retains all unique rows from the specified tables (synonym for union_distinct).
union_distinct – Retains all unique rows from the specified tables.
except – Retains all unique rows from the first table that do not appear in the second table (only works on 2 tables).
except_all – Retains all rows(including duplicates) from the first table that do not appear in the second table (only works on 2 tables).
intersect – Retains all unique rows that appear in both of the specified tables (only works on 2 tables).
intersect_all – Retains all rows(including duplicates) that appear in both of the specified tables (only works on 2 tables).
The default value is ‘union_all’.
chunk_size – Indicates the number of records per chunk to be used for this output table.
chunk_column_max_memory – Indicates the target maximum data size for each column in a chunk to be used for this output table.
chunk_max_memory – Indicates the target maximum data size for all columns in a chunk to be used for this output table.
create_indexes – Comma-separated list of columns on which to create indexes on the output table. The columns specified must be present in input parameter output_column_names.
partition_type – Partitioning scheme to use for the output table. Allowed values are:
RANGE – Use range partitioning.
INTERVAL – Use interval partitioning.
LIST – Use list partitioning.
HASH – Use hash partitioning.
SERIES – Use series partitioning.
partition_keys – Comma-separated list of partition keys, which are the columns or column expressions by which records will be assigned to partitions defined by partition_definitions.
partition_definitions – Comma-separated list of partition definitions, whose format depends on the choice of partition_type. See range partitioning, interval partitioning, list partitioning, hash partitioning, or series partitioning for example formats.
is_automatic_partition – If true, a new partition will be created for values which don’t fall into an existing partition. Currently only supported for list partitions. Allowed values are:
true
false
The default value is ‘false’.
ttl – Sets the TTL of the output table specified in input parameter table_name.
persist – If true, then the output table specified in input parameter table_name will be persisted and will not expire unless a ttl is specified. If false, then the output table will be an in-memory table and will expire unless a ttl is specified otherwise. Allowed values are:
true
false
The default value is ‘false’.
view_id – ID of view of which this output table is a member. The default value is ‘’.
force_replicated – If true, then the output table specified in input parameter table_name will be replicated even if the source tables are not. Allowed values are:
true
false
The default value is ‘false’.
strategy_definition – The tier strategy for the table and its columns.
compression_codec – The default compression codec for this table’s columns.
no_count – Return a count of 0 for the union table response to avoid the cost of counting; optimization needed for many chunk virtual unions. The default value is ‘false’.
The default value is an empty dict ( ).
Returns
A dict with the following entries–
Value of input parameter table_name.
Additional information. Allowed keys are:
count – Number of records in the final table.
qualified_table_name – The fully qualified name of the result table (i.e. including the schema).
The default value is an empty dict ( ).