Skip to main content
create_join_table(join_table_name=None, table_names=None, column_names=None, expressions=[], options=)[source]

Creates a table that is the result of a SQL JOIN.

For join details and examples see: Joins. For limitations, see Join Limitations and Cautions.

Parameters

join_table_name (str) –

Name of the join table to be created, in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria.

table_names (list of str) –

The list of table names composing the join, each in [schema_name.]table_name format, using standard name resolution rules. Corresponds to a SQL statement FROM clause. The user can provide a single element (which will be automatically promoted to a list internally) or a list.

column_names (list of str) –

List of member table columns or column expressions to be included in the join. Columns can be prefixed with ‘table_id.column_name’, where ‘table_id’ is the table name or alias. Columns can be aliased via the syntax ‘column_name as alias’. Wild cards ‘*’ can be used to include all columns across member tables or ‘table_id.*’ for all of a single table’s columns. Columns and column expressions composing the join must be uniquely named or aliased–therefore, the ‘*’ wild card cannot be used if column names aren’t unique across all tables. The user can provide a single element (which will be automatically promoted to a list internally) or a list.

expressions (list of str) –

An optional list of expressions to combine and filter the joined tables. Corresponds to a SQL statement WHERE clause. For details see: expressions. The default value is an empty list ( [] ). The user can provide a single element (which will be automatically promoted to a list internally) or a list.

options (dict of str to str) –

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 join_table_name. This is always allowed even if the caller does not have permission to create tables. The generated name is returned in qualified_join_table_name. Allowed values are:

    • true

    • false

    The default value is ‘false’.

  • collection_name – [DEPRECATED–please specify the containing schema for the join as part of input parameter join_table_name and use GPUdb.create_schema() to create the schema if non-existent] Name of a schema for the join. If the schema is non-existent, it will be automatically created. The default value is ‘’.

  • max_query_dimensions – No longer used.

  • strategy_definition – The tier strategy for the table and its columns.

  • ttl – Sets the TTL of the join table specified in input parameter join_table_name.

  • view_id – View this projection is part of. The default value is ‘’.

  • no_count – Return a count of 0 for the join table for logging and for GPUdb.show_table(); optimization needed for large overlapped equi-join stencils. The default value is ‘false’.

  • chunk_size – Maximum number of records per joined-chunk for this table. Defaults to the gpudb.conf file chunk size.

  • enable_virtual_chunking – Collect chunks with accumulated size less than chunk_size into a single chunk. The default value is ‘false’.

  • max_virtual_chunk_size – Maximum number of records per virtual-chunk. When set, enables virtual chunking. Defaults to chunk_size if virtual chunking otherwise enabled.

  • min_virtual_chunk_size – Minimum number of records per virtual-chunk. When set, enables virtual chunking. Defaults to chunk_size if virtual chunking otherwise enabled.

  • enable_sparse_virtual_chunking – Materialize virtual chunks with only non-deleted values. The default value is ‘false’.

  • enable_equi_join_lazy_result_store – Allow using the lazy result store to cache computation of one side of a multichunk equi-join. Reduces computation but also reduces parallelism to the number of chunks on the other side of the equi-join.

  • enable_predicate_equi_join_lazy_result_store – Allow using the lazy result store to cache computation of one side of a multichunk predicate-equi-join. Reduces computation but also reduces parallelism to the number of chunks on the other side of the equi-join.

  • enable_pk_equi_join – Use equi-join to do primary key joins rather than using primary key index.

The default value is an empty dict ( ).

Returns

A dict with the following entries–

join_table_name (str) –

Value of input parameter join_table_name.

count (long) –

The number of records in the join table filtered by the given select expression.

info (dict of str to str) –

Additional information. Allowed keys are:

  • qualified_join_table_name – The fully qualified name of the join table (i.e. including the schema).

The default value is an empty dict ( ).