Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt

Use this file to discover all available pages before exploring further.

final class atoti.MultiRowArrayConversion

Convert an external table where array values are stored with one value per row to a table with array columns. The external table must have an index_column and at least one “value” column representing the array elements. All the table columns except from index_column and the array_columns will become key columns.

Example

>>> external_database = session.connect_to_external_database(connection_config)
>>> external_table = external_database.tables["TUTORIAL", "MULTI_ROW_QUANTITY"]
external_table has an INDEX column:
>>> list(external_table)
['PRODUCT', 'INDEX', 'QUANTITY']
and its content is:
PRODUCTINDEXQUANTITY
product_1010
product_1120
product_1215
product_1325
product_1410
product_2050
product_2165
product_2255
product_2330
product_2480
It can be converted into a table with an array column:
>>> table = session.add_external_table(
...     external_table,
...     config=TableConfig(
...         array_conversion=tt.MultiRowArrayConversion(
...             array_columns={"QUANTITY"},
...             index_column="INDEX",
...         ),
...     ),
...     table_name="Sales (Multi row array)",
... )
>>> table.head().sort_index()
                                 QUANTITY
PRODUCT
product_1  [10.0, 20.0, 15.0, 25.0, 10.0]
product_2  [50.0, 65.0, 55.0, 30.0, 80.0]

array_columns : Set[str]

Names of the columns that contain array values.

index_column : str

Name of the column used as an index for the arrays.