BIND_COLUMNS()

All functions > CORE > BIND_COLUMNS()

Binds columns from a table to the given features.

Signatures

Returns: A table with the selected columns bound to features

BIND_COLUMNS(
  column, ...
  FROM { TABLE(table) | SQL(query) | CSV(text) | TSV(text) | JSON(text) }
) → TABLE<T>
ParameterTypeRequiredDescription
columnidentifierYesSource column whose values are bound to the input at the same position
tableidentifierNoFROM TABLE(...): table of the query backend, such as shop.customers
querySQLNoFROM SQL(...): query run by the query backend
textVARCHARNoFROM CSV/TSV/JSON(...): the embedded rows

Notes

  • Used in the FOR clause: FOR CUSTOMER_ID := BIND_COLUMNS(id FROM TABLE(shop.customers))
  • Columns are matched to the bound inputs in order, so FOR (A, B) := BIND_COLUMNS(a_col, b_col FROM ...) needs as many columns as inputs
  • Sources: TABLE(name), SQL(query), CSV(text), TSV(text), JSON(text)

See also

Examples

Bind INPUTs from physical table columns

FeatureQL
DEFINE
    input1 := INPUT(BIGINT),
    input2 := INPUT(BIGINT),
    add_inputs := input1 + input2
RETURN
    input1,
    input2,
    add_inputs
FOR
    (input1, input2) := BIND_COLUMNS(
        val1,
        val2
        FROM TABLE(bnd.table_example)
    )
;
Result
INPUT1 BIGINTINPUT2 BIGINTADD_INPUTS BIGINT
224
347
4610